Move all images in a directory into a directory hierarchy based on year, month and day based on exif information

exiftool '-Directory<DateTimeOriginal' -d %Y/%m/%d dir
This command would move the file "dir/image.jpg" with a "DateTimeOriginal" of "2005:10:12 16:05:56" to "2005/10/12/image.jpg". This is a literal example from the exiftool man page, very useful for classifying photo's. The possibilities are endless.
Sample Output
    1 directories scanned
    1 directories created
  222 image files updated
    1 image files unchanged

By: karel1980
2009-08-04 11:47:34

1 Alternatives + Submit Alt

What Others Think

Anything like this for Music?
matthewbauer · 637 weeks and 4 days ago
I recall id3v2 can print id3v2 tags so maybe that can be used to do something similar? More logic would be required to do the same with other (free ;) music formats. Python may be a better choice as it comes with batteries :)
spaceyjase · 637 weeks and 4 days ago
mp3info does what I want: for file in *.mp3;do mv "${file}" $(mp3info -p "%a/%l/%t.mp3" "${file}");done The problem is mv won't create directories.
matthewbauer · 637 weeks and 3 days ago
then how about a mkdir -p $(mp3info -p "%a/%l") before the mv?
dstahlke · 637 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: