Rename AND move in one command

Started by karanrajpal14, January 07, 2016, 11:56:25 AM

Previous topic - Next topic

karanrajpal14

Hey,

I just started using this tool to whip my library into shape and I must say, I'm impressed by what it can do. You've done an amazing job with it!
I have one doubt. I am using this to rename my images but for the life of me, I can't figure out how to move my renamed photos to the respective year directory AFTER renaming them.

exiftool -d %Y.%m.%d_%H.%M.%S%%-c -ext nef -ext jpg -ext jpeg -ext mp4 \
'-filename<${Exif:DateTimeOriginal;}_${Exif:Make;}_${Exif:Model;}_${Composite:ImageSize;}_${Composite:Megapixels;}MP.%le' '-directory=%Y/' \
'-filename<${Exif:DateTimeOriginal;}_${Exif:Make;}_${Exif:Model;}_${Composite:ImageSize;}_${Composite:Megapixels;}MP_${MakerNotes:FileNumber;}.%le' '-directory=%Y/' .


I tried playing around with the directory flag by specifying %Y as a parameter but it literally creates a "%Y" dirtectory and doesn't substitute for it. What am I doing wrong? Would you please help me out with this?

Thanks!

Phil Harvey

You get a "%Y" for the directory name because you are assigning it directly (with =).

But you can do what you want by specifying a directory with the file name, ie)

exiftool -d %Y/%Y.%m.%d_%H.%M.%S%%-c -ext nef -ext jpg -ext jpeg -ext mp4 \
'-filename<${Exif:DateTimeOriginal;}_${Exif:Make;}_${Exif:Model;}_${Composite:ImageSize;}_${Composite:Megapixels;}MP.%le'


This is mentioned in the 3rd paragraph on the Writing FileName and Directory tags page.

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

karanrajpal14

That was the first thing I tried, it didn't work. All it does is append another 2016 in the beginning of the filename like so

Quote20162016.01.01_03.05.28_NIKON CORPORATION_NIKON D3300_6000x4000_24.0MP_0825

Phil Harvey

Did you forget the "/" after "%Y"?

If not, then something else must be eating this slash.

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

karanrajpal14

I didn't. From all the articles that I've read, that shoul've worked but it didn't. That's why I'm seekinghelp here. Any idea what's going wrong? Any other workaround?

Phil Harvey

Try writing the TestName tag instead of FileName for testing purposes, and/or try simplifying your command to see if you can get directories to work at all.

What type of shell are you using?

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

karanrajpal14

I figured out waht was "eating" up the slash. It's the semicolon in the ${DateTimeOriginal;} which is removing it because it considers it to be illegal character. What a noob mistake :P
Thank you so much for trying. Sorry for taking up your time!

Phil Harvey

Ah!!! I should have caught that.

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