ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: pedroparamo on June 10, 2014, 03:15:39 PM

Title: rename file command
Post by: pedroparamo on June 10, 2014, 03:15:39 PM
I would like to use the following

exiftool -d %d%m%Y.%%e "-filename<CreateDate" dir

but I would like to rename the files to the date (in this format) plus a dash and numbered consecutively from '-0-99'?  Is there a way to do this?

Thanks.

Pedro
Title: Re: rename file command
Post by: StarGeek on June 10, 2014, 04:42:15 PM
Try
exiftool -d %d-%m-%Y-%%1C.%%e "-filename<CreateDate" Dir

Edit: That's the number One to the left of the capital C.  On my computer it looks like it might be an L, so I wanted to be clear.  Or just copy/paste it.
Title: Re: rename file command
Post by: pedroparamo on June 10, 2014, 08:28:20 PM
Great--thanks!  One more question--what would be the command it I wanted to rename the files to the name of the directory they are in and the -%%1C (dash 1-99)?

Pedro
Title: Re: rename file command
Post by: Phil Harvey on June 11, 2014, 07:05:29 AM
Hi Pedro,

This could do it:

exiftool "-filename<${Directory;s(/$)();s(.*/)()}-%C.%e" DIR

(use single quotes instead of double if you are on Mac or Linux)

- Phil
Title: Re: rename file command
Post by: pedroparamo on June 11, 2014, 09:03:50 AM
great thanks!  One final question.  If I want to copy the all the meta info from the FIRST file in a directory to all the other files in the same directory is that possible?  Tagsfromfile command?  I' using an applescript to call a shell script like this

set cmd to "exiftool -tagsfromfile" & " " & theFile & "-r -ext JPG dir"
   set theResult to do shell script cmd

where the file is an alias of the file from which contains the meta info I want to copy.  I get an (applescript) error

File 'Server' does not exist for -tagsFromFile option

Is there a better way to refer to the refer to my file?

Thanks again.

Pedro

Title: Re: rename file command
Post by: pedroparamo on June 11, 2014, 09:32:15 AM
I think there is something wrong with my syntax and use of "".  'theFile' somehow includes '-r'  ???  any suggestions???  One  mistake which I fixed was theFile was an alias--I'm now using 'quoted form of (POSIX path of theFile)' which works except for the '-r' error in the file name.
Title: Re: rename file command
Post by: Phil Harvey on June 11, 2014, 10:13:57 AM
You need a space before -r in your string.

To copy the metadata from the first file, you will need to determine the name of the first file somehow and insert that into your command string.

- Phil
Title: Re: rename file command
Post by: pedroparamo on June 11, 2014, 02:27:13 PM
I've determined the filename but my syntax is still off.

I'm using

set cmd to "exiftool -tagsfromfile" & space & space & theExifFileName & space & "-r -ext JPG" & space & thisFolderPath

which gives me this (on a Mac)

exiftool -tagsfromfile  11111-01.JPG -r -ext JPG '/Users/administrator/11111/JPEGs/'"


in the command line but returns the error

"File '11111-01.JPG' does not exist for -tagsFromFile option"

The file DOES exist.  Suggestions???

pedro
Title: Re: rename file command
Post by: Phil Harvey on June 11, 2014, 02:30:53 PM
Hi Pedro,

I have two questions:

1) What directory is the -tagsFromFile file in?

2) What is the working directory for the exiftool process?

If the answers to these questions are not the same, then you need to specify a path in your -tagsFromFile argument.

- Phil
Title: Re: rename file command
Post by: pedroparamo on June 11, 2014, 11:53:22 PM
Thanks!  That was it.  Once I specified the path for my -tagsFromFile argument it works.

"exiftool -tagsfromfile" & space & thisFilePath & space & "-r -ext JPG" & space & thisFolderPath

pedro