ExifTool Forum

ExifTool => Newbies => Topic started by: fuyang on June 26, 2022, 12:50:40 PM

Title: Want to move all raw image to another loc or drive but keep the folder structure
Post by: fuyang on June 26, 2022, 12:50:40 PM
Over the years, I accumulated a lot of raw images in my pic folders, hoping later I can process those raw images. I took time lapse photos a lot, so I have a lot of raw images from time lapse shooting. Those raw image took huge space in my harddrive. I want to move all raw image out of my picture folder to a backup drive. But I have hard time to figure it out how to do this with exiftool after hours of google search. I demonstrate what I want to do below:

Move all raw images to G drive but keep folder structures. I have tens of throusands of images to move.
Original folder structure
F:\Users\id\OneDrive\Pictures\2022
                  \2022--06-25-1
                     0001.nef
                     0001.jpg
After move folder structure
F:\Users\id\OneDrive\Pictures\2022
                  \2022--06-25-1
                     0001.jpg
G:\nef\2022
                  \2022--06-25-1
                     0001.nef


Thanks in Advance!
Title: Re: Want to move all raw image to another loc or drive but keep the folder structure
Post by: fuyang on June 26, 2022, 05:20:41 PM
I ended up using this command to move raw image files to the backup drive, not keeping exact folder structure. I still want to know how to keep the folder structure if somebody can show me how. I think most people here know nef is Nikon camera raw image file extension name.

exiftool -r -ext NEF -d %Y/%Y-%m-%d "-directory<g:\nef\$CreateDate" .


I just tested on one directory, it works like this:

test folder:

F:\Users\fuyan\OneDrive\Pictures\Timelapse\2017 Timelapse\2017-10-27 night1

new folder created and nef image files moved to:

G:\nef\2017\2017-10-27

Not exactly what I want, but it serves 75% of my purpose.

Again I still want to learn how to move files to another location and keep the folder structure.

Thanks!

Title: Re: Want to move all raw image to another loc or drive but keep the folder structure
Post by: StarGeek on June 26, 2022, 08:02:28 PM
Given the directory structure you posted first, as it appeared to be based upon the date, your second post command would have been what I was going to recommend.

But if the directory structure is different, then you'd want to use the %d token, altered as shown under the "Advanced features" section of the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).

Something like
exiftool -ext nef -r -Directory=G:\nef\%:5d F:\Users\id\OneDrive\Pictures\

The %d would indicate the directory of the file.  Adding the colon# :5 indicates you want to remove the top 5 levels of the path, changing F:\Users\id\OneDrive\Pictures\2022\2022--06-25-1\ into \2022\2022--06-25-1\.  You then prepend the target location, G:\nef\
Title: Re: Want to move all raw image to another loc or drive but keep the folder structure
Post by: fuyang on June 26, 2022, 08:29:18 PM
Thanks, StarGeek! I will give it a try.