ExifTool Forum

ExifTool => Newbies => Topic started by: karanrajpal14 on January 07, 2016, 11:56:25 AM

Title: Rename AND move in one command
Post by: karanrajpal14 on January 07, 2016, 11:56:25 AM
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!
Title: Re: Rename AND move in one command
Post by: Phil Harvey on January 07, 2016, 12:01:58 PM
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 (https://exiftool.org/filename.html).

- Phil
Title: Re: Rename AND move in one command
Post by: karanrajpal14 on January 07, 2016, 12:06:35 PM
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
Title: Re: Rename AND move in one command
Post by: Phil Harvey on January 07, 2016, 12:08:27 PM
Did you forget the "/" after "%Y"?

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

- Phil
Title: Re: Rename AND move in one command
Post by: karanrajpal14 on January 07, 2016, 12:13:14 PM
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?
Title: Re: Rename AND move in one command
Post by: Phil Harvey on January 07, 2016, 12:25:09 PM
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
Title: Re: Rename AND move in one command
Post by: karanrajpal14 on January 07, 2016, 12:54:19 PM
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!
Title: Re: Rename AND move in one command
Post by: Phil Harvey on January 07, 2016, 12:55:34 PM
Ah!!! I should have caught that.

- Phil