I've been trying to sort this one out without much success and its likely I'm missing something. I'd appreciate any help.
There are some photos in a directory C:\path\to\dirname. Is there any way to rename the photos using as prefix the name of the last directory in the path? The filenames will be of the form DIRNAME_rest_of_filename.ext. Using the command below was not successful:
exiftool "-filename=%d_%2c.%e" dirname
Many thanks in advance.