Picture Renamer

jhead -n%Y%m%d-%H%M%S *.jpg
jhead is a very nice tool to do all sorts of things with photographs, in a batch-oriented way. It has a specific function to rename files based on dates, and the format I used above was just an example.
Sample Output
09:17:50 sita-wd:jhead-test $ ls -al
total 5824
drwxr-xr-x  2 sitaram sitaram   4096 2009-08-10 09:17 ./
drwxr-xr-x 15 sitaram sitaram   8192 2009-08-10 09:09 ../
-rw-r-----  1 sitaram sitaram 862814 2009-08-10 09:17 img_3140.jpg
-rw-r-----  1 sitaram sitaram 659554 2009-08-10 09:17 img_3141.jpg
-rw-r-----  1 sitaram sitaram 842226 2009-08-10 09:17 img_3142.jpg
-rw-r-----  1 sitaram sitaram 757260 2009-08-10 09:17 img_3143.jpg
-rw-r-----  1 sitaram sitaram 603396 2009-08-10 09:17 img_3144.jpg
-rw-r-----  1 sitaram sitaram 756835 2009-08-10 09:17 img_3145.jpg
-rw-r-----  1 sitaram sitaram 790922 2009-08-10 09:17 img_3146.jpg
-rw-r-----  1 sitaram sitaram 660837 2009-08-10 09:17 img_3149.jpg
09:17:52 sita-wd:jhead-test $ jhead -n%Y%m%d-%H%M%S *.jpg
img_3140.jpg --> 20060121-114040.jpg
img_3141.jpg --> 20060121-114102.jpg
img_3142.jpg --> 20060121-114154.jpg
img_3143.jpg --> 20060121-114158.jpg
img_3144.jpg --> 20060121-114202.jpg
img_3145.jpg --> 20060121-114207.jpg
img_3146.jpg --> 20060121-114214.jpg
img_3149.jpg --> 20060121-114823.jpg
09:17:57 sita-wd:jhead-test $ ls -al
total 5824
drwxr-xr-x  2 sitaram sitaram   4096 2009-08-10 09:17 ./
drwxr-xr-x 15 sitaram sitaram   8192 2009-08-10 09:09 ../
-rw-r-----  1 sitaram sitaram 862814 2009-08-10 09:17 20060121-114040.jpg
-rw-r-----  1 sitaram sitaram 659554 2009-08-10 09:17 20060121-114102.jpg
-rw-r-----  1 sitaram sitaram 842226 2009-08-10 09:17 20060121-114154.jpg
-rw-r-----  1 sitaram sitaram 757260 2009-08-10 09:17 20060121-114158.jpg
-rw-r-----  1 sitaram sitaram 603396 2009-08-10 09:17 20060121-114202.jpg
-rw-r-----  1 sitaram sitaram 756835 2009-08-10 09:17 20060121-114207.jpg
-rw-r-----  1 sitaram sitaram 790922 2009-08-10 09:17 20060121-114214.jpg
-rw-r-----  1 sitaram sitaram 660837 2009-08-10 09:17 20060121-114823.jpg
09:18:00 sita-wd:jhead-test $

4
2009-08-10 03:49:30

2 Alternatives + Submit Alt

What Others Think

Predictably available as package 'jhead' under debian/ubuntu.
bwoodacre · 480 weeks and 1 day ago
and media-gfx/jhead for gentoo
amaymon · 480 weeks and 1 day 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: