this post was submitted on 09 Aug 2023
1829 points (92.8% liked)

Memes

44132 readers
2686 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS
1829
2023-08-09.jpg (lemmy.ml)
submitted 11 months ago* (last edited 11 months ago) by [email protected] to c/[email protected]
 
you are viewing a single comment's thread
view the rest of the comments
[–] cerberus 43 points 11 months ago (2 children)

ISO 8601 is amazing for data storage and standardizing the date.

Display purposes sure, whatever you feel like

But goddammit if you don’t use ISO 8601 to store dates, I will find you, and I will standardize your code.

[–] datelmd5sum 6 points 11 months ago (2 children)
[–] [email protected] 13 points 11 months ago

Epoch is also acceptable if humans don't need to understand it

[–] cerberus 2 points 11 months ago

I will agree it’s a valid storage but it has to be specified in ms

[–] [email protected] 4 points 11 months ago (3 children)

I actually need to standardize my code. I've got "learning F2" as something I want to do soon. The goal: use the exif data of my pictures to create [date in ISO 8601] - [original filename].[original file type termination]

So a picture taken the third of march 2022 titled "asdf.jpg" would become "2022-3-3 - asdf.jpg"

Help? lol

[–] [email protected] 6 points 11 months ago (1 children)

If you're on Linux exiftool can get the creation date for you: exiftool -p '$CreateDate' -d '%Y-%m-%d' FILENAME, and you could run tgat in a loop over your files, something like:

mkdir -p out
for f in *.jpg
do
createdate=$(exiftool -p '$CreateDate' -d '%Y-%m-%d' "${f}")
cp -p "${f}" "out/${createdate} - ${f}"
done

Obviously don't justbgo running code some stranger just posted on the internet, especially as I haven't tested it, but that should copy images from the current directory to a subdirectory called 'out' with the correct filenames.

[–] [email protected] 2 points 11 months ago (2 children)

ok I think I finally need to ask

What the fuck is up with the html code? Ive seen this in a lot of posts and it just throws me every time.

[–] [email protected] 7 points 11 months ago

I don't see any HTML when I look at that comment from Lemmy, but kbin seems to make a real mess of rendering code blocks. Basically that bit had a few lines of code they could yse to do what they wanted.

[–] [email protected] 1 points 11 months ago

Do you mean strings like %Y? They're not url-encoded values - they're strftime format directives.

[–] [email protected] 2 points 11 months ago

I did this in the past and I would search through my notes... If I had notes ffs.

[–] cerberus 1 points 11 months ago (1 children)

Can you give more context, what are you using? Language / system / etc?

[–] [email protected] 1 points 11 months ago (1 children)

I'm using NixOS. Ext4 filesystem. As to language, I'm not entirely sure what you mean. If you refer to the character set in the filenames, I think there are no characters that deviate from the English alphabet, numbers, dashes, and underscores.

[–] cerberus 1 points 11 months ago

Oh ok so you’re more so working with folder structure etc, so bash for when you plug-in a card?

I’m thinking in more programmatic terms, there’s definitely some bash scripting you can execute. Or just go balls out and write a service that executes on systemctl