Can ExifTool sort photos by date while preserving the original subfolder names?
Asked 10/18/2015
2 views
2 answers
0
I have a parent folder with subfolders for different devices/people, for example:
- from my cell phone
- from my camera
- Johns camera
- Cindys camera
I currently use ExifTool to move images into date-based folders with:
exiftool "-directory<EXIF:DateTimeOriginal" -d %Y%m%d -r .
That creates folders by date, but it loses the original source subfolder structure. I’d like the result to look more like:
20151020/from my cell phone/20151020/from my camera/20151021/Johns camera/
so the photos are grouped by capture date first, while still keeping the original subfolder name.
Is that possible with ExifTool?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
10y ago
2 Answers
1
Make sure the parent directory is your current directory and you can use this command:
exiftool "-directory<EXIF:DateTimeOriginal" -d "%Y%m%d/%%d" -r .
Example, given this tree \f for the current directory, then running the above command, gives the end result:
X:\!temp\test>tree /f
Folder PATH listing for volume Data
Volume serial number is 00000200 1CFF:E96C
X:.
│ 20140404_040404.jpg
│ 20150303_030303.jpg
│
└───2010
└───12
└───25
Test.jpg
X:\!temp\test>exiftool -d "%Y%m%d/%%d" "-directory<DateTimeOriginal" -r .
4 directories scanned
3 directories created
3 image files updated
X:\!temp\test>tree /f
Folder PATH listing for volume Data
Volume serial number is 00000200 1CFF:E96C
X:.
│
├───2010
│ └───12
│ └───25
├───20101225
│ └───2010
│ └───12
│ └───25
│ Test.jpg
│
├───20140404
│ 20140404_040404.jpg
│
└───20150303
20150303_030303.jpg
Test.jpg still retains the 2010/12/25 path under the new directory. Also note that the original directory is not removed.
The addition of %%d escapes the last %d so it is interpreted as the directory from the -w option instead of the date from the -d option.
This command will result in different results if you aren't using the current directory. If the current directory is on a different drive than the target directory, then you will most likely get an error as it tries to append the target directory name onto the current directory, something like c:\CurrentDir\D:\TargetDir. If this needs to be done, then look into the %d options under the -w option.
Originally by user37960. Source · Licensed CC BY-SA 4.0
user37960
9y ago
0
Generated from our catalog & community — verify before relying on it.
Yes. Run ExifTool from the parent folder and include the original directory name in the destination path:
exiftool "-directory<DateTimeOriginal" -d "%Y%m%d/%%d" -r .
How it works:
%Y%m%dcreates the date folder fromDateTimeOriginal.%%dpreserves the existing relative directory path under the current folder.-r .processes files recursively from the current directory.
So files originally in folders like from my cell phone or Johns camera will be moved into a structure such as:
20151020/from my cell phone/20151020/Johns camera/
Make sure your current working directory is the top-level parent folder before running the command.
Recommended products
UniqueBot
AI10y ago
Your Answer
Related Questions
How can I sort photos into folders based on their shooting date?
How can I organize photos and videos into date folders using the file modification date on Windows?
Can Lightroom automatically reorganize existing photo folders by year?
How can I use ExifTool to copy only photos rated 4+ into one export folder and ignore dotfiles?
How can I batch-set EXIF dates from a parent folder name in ExifTool?