Custom prefix for %c

Started by Andrey Kazak, June 24, 2023, 10:07:45 AM

Previous topic - Next topic

Andrey Kazak

Greetings!

  ExifTool version 12.63 for Windows

  https://exiftool.org/filename.html and https://exiftool.org/exiftool_pod.html provide the following syntax for using %c:
  exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%e dir
QuoteRename all images in dir according to the CreateDate date and time, adding a copy number with leading '-' if the file already exists (%-c), and preserving the original file extension (%e). Note the extra '%' necessary to escape the filename codes (%c and %e) in the date format string.

How do I specify a custom prefix for the number, other than leading dash ('-') if the file already exists?
For example, a white space (" ") or an underscore ("_").

Thank you.

StarGeek

There isn't one.  You can use an underscore with with a leading plus sign +, but that's it.  Anything else you will have to hard code, but that will affect the first copy where the copy number is omitted unless you have the dot added.

See the -w (-TextOut) option, Advanced features section.
"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

Andrey Kazak

Quote from: StarGeek on June 24, 2023, 11:53:26 AMYou can use an underscore with with a leading plus sign +, but that's it.

Thank you.
Underscore is fine for me.
Is this the correct syntax for the underscore case?
exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S[b]%%+_c[/b].%%e dir

StarGeek

No, the same as you first command, but with a plus instead.  Please read the link I provided.
"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

Andrey Kazak

Quote from: StarGeek on June 25, 2023, 01:20:35 AMNo, the same as you first command, but with a plus instead.  Please read the link I provided.

Got it!

Thank you for helping me.

QuoteFor %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, the copy number is omitted from the first file of a given name, but this can be changed by adding a decimal point to the modifier. For example:

    -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 ...
    -w I.%.3uc.txt    # I.AAA.txt, I.AAB.txt, I.AAC.txt ...
Source: https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut