Move pics and movies to directory with DateTimeOriginal

Advanced Renamer forum
#1 : 06/02-23 22:49
Dave Franks
Posts: 5
I have a directory with pics and videos. I would like the output filename and path to reflect the date/time they were taken (not creation date of the file).

If I have IMG_1234.JPG and MVI_5678.MP4 I would like them copied/renamed to:

z:\Pictures\YYYY\MM\DD\YYYYMMDD_HHMMSS_IMG_1234.JPG
z:\Pictures\YYYY\MM\DD\YYYYMMDD_HHMMSS_MRI_5678.MP4

I got the name to change with:
NEW NAME <ExifTool:DateTimeOriginal> <name>.<Ext>
REMOVE PATTERN _
REPLACE space with _

I have not figured out how to change the output folder using DateTimeOrig. I can only change it to the file date which is not what I need. I can put <ExifTool:DateTimeOriginal> in the output path but the format is "YYYY_MM_DD HH_MM_SS". How do I get the path to be z:\Pictures\YYYY\MM\DD? I really want to be able to edit the path similar to the way I edit the name.
#2 : 07/02-23 09:42
David Lee
Posts: 1125
Use a Script method with Batch Mode: Rename and specify item.newPath in the script.

date = app.parseTags("<ExifTool:DateTimeOriginal>").split(/[_ ]/);
Y = date[0];
M = date[1];
D = date[2];
h = date[3];
m = date[4];
s = date[5];
item.newPath = "Z:\\Pictures\\" + Y + "\\" + M + "\\" + D;
return Y + M + D + "_" + h + m + s + "_" + item.name;