ExifTool Forum

ExifTool => Newbies => Topic started by: albertop9 on February 05, 2013, 06:33:29 PM

Title: Can ExifTool on Mac OS X output forward slashes in filenames?
Post by: albertop9 on February 05, 2013, 06:33:29 PM
So I happily found ExifTool... and being an ab-so-lute newbie at the command line, I've made myself almost proud by almost achieving my file renaming goals WITHOUT bothering you the experts with any silly newbie questions. How good is that!

...We must thank our hero Phil not only for the program but for the excellent documentation too, really.

Anyways, after several hours of reading, searching, re-reading, grasping... finally here's my (ahem...) mandatory silly question!  ;D

I can get my files renamed with their creation date like this: 2012-12-31-001.ext
But can ExifTool on Mac OS X give me this?: 2012/12/31-001.ext

That's all. Many thanks in advance!
Alberto
Spain
Title: Re: Can ExifTool on Mac OS X output forward slashes in filenames?
Post by: Phil Harvey on February 05, 2013, 06:42:03 PM
Hi Alberto,

Congratulations on your success. :)

Your question isn't silly at all.  As you have probably found out, a forward slash in the file name will cause a new directory to be created.  There is in fact no way to get a forward slash into a file name using ExifTool.  However, here is the good news:  You can get a colon in a file name.  And, get ready for this... Mac OS X displays a colon in a file name as a forward slash.  Weird huh?

- Phil
Title: Re: Can ExifTool on Mac OS X output forward slashes in filenames?
Post by: perspixe on February 07, 2013, 02:31:24 AM
Hi Phil,
First I am on Mac 10.8.
a bit related question. With slashes in file names.

I have a bracketed time lapse and trying to rename files writing the shutter speed in the file name, so I can sort these easily.
But ${ShutterSpeed} have a slash as in 1/125, and so a directory is created at root of user and the image file moved in there with only what's after the slash as name.
I also write full date and time in the name and subseconds as milliseconds. Note that once I manage to write the shutter speed, the subseconds will be unnecessary.

So how to get rid of the slash in shutter speed? And replace it by something else?
Maybe I could multiply the shutter speed by 10000 and get a number that is in tenth of milliseconds?
Not intuitive but with shutterspeed eventually > 1/1000, but always <1/4000 with my cameras that would work?

The thing is I have all these ideas but I do not know how to code that...

here is the full command to do it with a whole directory:

exiftool -r -d %Y-%m-%d_%H-%M-%S- '-filename<${datetimeoriginal}${subsectimeoriginal}0-${ShutterSpeed}.%e'

Thanks a lot
Title: Re: Can ExifTool on Mac OS X output forward slashes in filenames?
Post by: Phil Harvey on February 07, 2013, 07:21:15 AM
To replace the "/" with an underline:

"${ShutterSpeed;tr(/)(_)}"

To multiply by 10000 and take the integer part:

"${ShutterSpeed#;$_=int($_*10000)}"

Note: This requires ExifTool 9.15 or later.

- Phil
Title: Re: Can ExifTool on Mac OS X output forward slashes in filenames?
Post by: perspixe on February 07, 2013, 07:33:28 AM
Thanks Phil

very impressive.

one more time a hero ;-)
Title: Re: Can ExifTool on Mac OS X output forward slashes in filenames?
Post by: albertop9 on February 07, 2013, 09:09:32 AM
Quote from: Phil Harvey on February 05, 2013, 06:42:03 PM
Mac OS X displays a colon in a file name as a forward slash.  Weird huh?

Weird... and cool!

Phil, thanks a lot for your friendly and quick reply. That made my day!  Now it'll be your fault if I end up into this c-line thing through ExifTool... This is looking so much more fun and rewarding than clicking on Menu Bar commands, man. :)

Cheers!
Alberto