rename file command

Started by pedroparamo, June 10, 2014, 03:15:39 PM

Previous topic - Next topic

pedroparamo

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

StarGeek

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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

pedroparamo

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedroparamo

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


pedroparamo

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.

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedroparamo

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

pedroparamo

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