Main Menu

Working with "c"

Started by deathrobot, February 11, 2015, 07:34:03 PM

Previous topic - Next topic

deathrobot

Another question. Currently, I'm using a shell script that is:

'-filename<CreateDate' -d %Y-%m-%d' '%H.%M.%S%%-c.%%le

in order to rename the files (so I don't have to use DIM). I'm trying to tweak the ending "-c" part. This currently names files with no suffix unless it's a duplicate, in which case it gives it a hyphen and single digit serial number. I'm trying to tweak it so that ALL files are suffixed "-00" and if a file is a duplicate it increments that by 1, so that the first duplicate would be suffixed "-01", the next "-02", etc. Example:

2015-01-01 01.10.10-00
2015-01-01 01.10.10-01

Thanks for any help.

Michael

Phil Harvey

The application documentation gives examples that should make this clear:

                −w A%−cZ.txt      # AZ.txt, A−1Z.txt, A−2Z.txt ...
                −w B%5c.txt       # B.txt, B00001.txt, B00002.txt ...
                −w C%.c.txt       # C0.txt, C1.txt, C2.txt ...
                −w D%−.c.txt      # D−0.txt, D−1.txt, D−2.txt ...
                −w E%−.4c.txt     # E−0000.txt, E−0001.txt, E−0002.txt ...
                −w F%−.4nc.txt    # F−0001.txt, F−0002.txt, F−0003.txt ...
                −w G%+c.txt       # G.txt, G_1.txt G_2.txt ...
                −w H%−lc.txt      # H.txt, H−b.txt, H−c.txt ...


It sounds like what you want is example E, with 2 digits instead of 4.

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

deathrobot

#2
Thank you, Phil. Got it working with your suggestion. On a side note, Hazel stopped running reliably with:

exiftool -if '$DateTimeOriginal' $1

Changing to this solved it:

exiftool -if '$DateTimeOriginal' "$1"