How would I `wget` files and then save them by date downloaded rather than filename?

3

My goal: To download 131 JPEGs and save them in a file name format that is relative to the date/time format rather than their file name.

I have already tried things that involve changing the files' names after they have already been downloaded. However, these methods do not work because it seems like exif data is not being kept. For example: jhead -n%Y%m%d-%H%M%S *.jpg just returns a bunch of errors saying:

Possible new names for for '{filename}.jpg' already exist
File '{filename}.jpg' contains no exif date stamp.  Using file date

Usually, as in this case, I wind up with less files than I started out with.

So is there some command I can pass to wget instead? I have already tried the --timestamp option with no success. (The man page is not to clear about what that does.)

Richard

Posted 2013-10-27T01:00:04.840

Reputation: 255

EXIF data is kept inside the file. The filesystem has no say on the matter. – user1686 – 2013-10-27T01:01:49.350

Oh, ok. Perhaps there's no way to solve it, then, unless there's a way to do it without using EXIF data. – Richard – 2013-10-27T01:09:38.860

Why not use the files' creation date and a renaming software that sorts by date created. – Doktoro Reichard – 2013-10-27T01:23:18.070

As I stated in my question: I tried that. – Richard – 2013-10-27T01:41:03.890

1@searchfgold6789: Your question states you tried the EXIF timestamp embedded in the photo (which some websites simply remove to reduce file size, or never add in the first place), not the same as timestamps of the file itself. – user1686 – 2013-10-27T02:53:59.537

@grawity Okay, you are correct. – Richard – 2013-10-27T18:05:15.053

Answers

8

wget url -O `date +"%Y%m%d-%H%M%S"`.jpg

Don't really know how to change the download URLs, that's something you have to figure out yourself.

Alex

Posted 2013-10-27T01:00:04.840

Reputation: 427

Here's a working example I use wget http://services.swpc.noaa.gov/images/planetary-k-index.gif -O /var/www/html/Kindex_images/date +"%Y%m%d-%H%M%S".gif

– None – 2015-09-17T00:16:52.070