Using the original directory name in the syntax

Started by alka, January 07, 2023, 05:21:02 PM

Previous topic - Next topic

alka

Hi,
I'm trying to use directories' current names as part of the output directory and file names. The attempt looks like this:
exiftool -r '-FileName<CreateDate' -d %Y%m%d%%d/%Y%m%d_%H%M%S%%d%%-c.%%e ., where the "%%d" part should be each files current directory's name. However, this isn't working, and I'd be very happy to get advice on what I'm doing wrong.

Previously, I've manually substituted the "%%d" part with for example "_my birthday party" and that has been working.

Given that I already have a bunch of files in directories that have been named with things like "my birthday party", "vacation" and similar, I'd like to just run the above (currently not working) code and have them all filed in new directories and named correctly.

Huge thanks in advance!

Phil Harvey

"isn't working" doesn't help much.  Try writing TestName instead of FileName to see what is happening before actually writing FileName.

The %%d represents the relative directory path based on what you specified on the command line.  Since you specified ".", %%d will be "./" for files in this directory, or something like "./SUBDIR_NAME" for sub-directories.  I doubt this is what you want.

Try using %%-1:D for just the bottom-level directory name.  See the -w option description in the application documentation for details.

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