Correcting iPhone photo filenames

Sometimes, when uploading photos from my iPhone’s camera roll (for example, when using Dropbox), the photo filename format ends up looking like this:

Photo 16-03-2012 21 21 10.jpg

This isn’t very nice. Much better to have something in ISO-8601 format, which sorts nicely in file listings, and so on. So I wrote a quick bash script to search for all the files in the current directory (and subdirectories), and rename them to this style:

Photo-2012-03-16-21-21-10.jpg

You can find it on github.

Please note that the script renames files immediately, with no confirmation. It depends on Perl’s rename under the covers, and if you pass in the -n flag, it does a dry run so it shows you the renames that would be done, but doesn’t actually do them.

(It also handles video files with similar names).

Comments

No worries - I found that the problem was more to do with Dropbox than the iPhone, so I tried using OneDrive and that does produce far better filenames. Not perfect but no spaces or illegal characters.
Paul, sorry, this script isn't suitable for Windows.
How do you use this script? I tried copying and pasting into a Notepad text document but saving as .exe but it wont run on a PC. No idea what to do :)