exiftool file rename not working on directories, only files

Started by corwin, May 10, 2010, 05:52:06 PM

Previous topic - Next topic

corwin

$uname -a
Linux corwin 2.6.31-1-amd64 #1 SMP Mon Nov 16 04:44:38 UTC 2009 x86_64 GNU/Linux

$ /usr/local/bin/exiftool -ver
8.18


https://exiftool.org/filename.html

The docs show that %%c is copy, so unless %%-c is a variation then Example1 has a typo:
exiftool -d %Y%m%d_%H%M%%-c.%%e "-filename<CreateDate" DIR
should be something like:
exiftool -d %Y%m%d_%H%M%S.%%e "-filename<CreateDate" DIR



$ exiftool -d %Y%m%d_%H%M%S.%%e "-filename<CreateDate" /home/michael/photos/2009-xx-xx_Michelles_Camera/test/
    1 directories scanned
    0 image files read

$ exiftool -d %Y%m%d_%H%M%S.%%e "-filename<CreateDate" /home/michael/photos/2009-xx-xx_Michelles_Camera/test/*mov
Warning: [minor] Overlapping MakerNotes values - /home/michael/photos/2009-xx-xx_Michelles_Camera/test/20091017_181517.mov
Warning: [minor] Overlapping MakerNotes values - /home/michael/photos/2009-xx-xx_Michelles_Camera/test/20091022_222744.mov
Warning: [minor] Overlapping MakerNotes values - /home/michael/photos/2009-xx-xx_Michelles_Camera/test/20091022_225726.mov
    0 image files updated
    3 image files unchanged


Phil Harvey

Quote from: corwin on May 10, 2010, 05:52:06 PM
The docs show that %%c is copy, so unless %%-c is a variation then Example1 has a typo:
exiftool -d %Y%m%d_%H%M%%-c.%%e "-filename<CreateDate" DIR
should be something like:
exiftool -d %Y%m%d_%H%M%S.%%e "-filename<CreateDate" DIR

From the -w documentation:

"For %c, these modifiers have a different effects. If a field width is given, the copy number is padded with zeros to the specified width. A leading '-' adds a dash before the copy number, and a '+' adds an underline. By default, a copy number of zero is omitted, but this can be changed by adding a decimal point to the modifier."

- 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 ($).

corwin

Cool, thanks for the clarification on the %c. Do you know when the directory bug will be addressed?

Phil Harvey

Directory bug?  OK, now I see what the rest of your message was about.

I think that reading FAQ number 16 may answer your question.

- 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 ($).

trinitron3

The 'directory bug' still stands if the -o option was provided, even if it was a dummy directory.

Using exiftool version 8.22

With the -o option:
exiftool -o dummy/ -ext jpg -ext avi -v0 -d %Y/%m/%Y-%m-%d "-directory<datetimeoriginal" /mnt/sdb1/dcim/100canon/

======== /mnt/sdb1/dcim/100canon/mvi_4717.avi
Error: Writing of AVI files is not yet supported - /mnt/sdb1/dcim/100canon/mvi_4717.avi
======== /mnt/sdb1/dcim/100canon/mvi_4667.avi
Error: Writing of AVI files is not yet supported - /mnt/sdb1/dcim/100canon/mvi_4667.avi


Without the -o option:
exiftool -ext jpg -ext avi -v0 -d %Y/%m/%Y-%m-%d "-directory<datetimeoriginal" /mnt/sdb1/dcim/100canon/
======== /mnt/sdb1/dcim/100canon/mvi_4717.avi
======== /mnt/sdb1/dcim/100canon/mvi_4667.avi
    1 directories scanned
    2 image files updated


Possibly because somewhere around the block starting at line 960, the scanwritable flag is set once the outopt flag is detected, whether or not the output flag is actually used.

Phil Harvey

Quote from: trinitron3 on June 18, 2010, 04:59:46 PM
The 'directory bug' still stands if the -o option was provided, even if it was a dummy directory.

The reason this didn't work is that when you use the -o option the file is rewritten, not just renamed, and I hadn't added the ability to rewrite unrecognized file types.

However, this was a trivial addition (since in this case the file is simply copied), so I have added this ability and released version 8.23 which should fix this for you.

Thanks for making this suggestion.

- 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 ($).