Moving Files to folder based on Date

Advanced Renamer forum
#1 : 20/08-24 04:24
Nikky
Posts: 9
This renames files and moves them to the folder based on the date. What happens if there is already a file in that folder with that specific name?

if (app.parseTags('<ExifTool:DateTimeOriginal>')) {
returnStr = app.parseTags('<ExifTool:DateTimeOriginal>');
year = returnStr.substr(0, 4);
month = returnStr.substr(5, 2);
day = returnStr.substr(8, 2);
hour = returnStr.substr(11, 2);
minute = returnStr.substr(14, 2);
second = returnStr.substr(17, 2);
} else if (app.parseTags('<ExifTool:FileCreateDate>')) {
returnStr = app.parseTags('<ExifTool:FileCreateDate>');
year = returnStr.substr(0, 4);
month = returnStr.substr(5, 2);
day = returnStr.substr(8, 2);
hour = returnStr.substr(11, 2);
minute = returnStr.substr(14, 2);
second = returnStr.substr(17, 2);
} else {
returnStr = "";
}

item.newPath = "C:\\_PHOTOS\\" + year + "\\" + month;
item.newName = year + month + day + "_" + hour + minute + second;
return item.newName;

edited: 20/08-24 16:37
#2 : 20/08-24 04:45
Nikky
Posts: 9
Is there a way to not move it if there is already one there named the same?

edited: 20/08-24 16:37
#3 : 21/08-24 16:16
Miguel
Posts: 141
Reply to #2:
Hi Nikki
I'm not a programmer so my answer may be useless, but if you right click on a file and select "Remove special ---> Remove erroneous items" you can avoid moving files with the same name.
You can also use the "Name collision rule" .

Regards

Miguel
#4 : 21/08-24 18:18
Delta Foxtrot
Posts: 296
Reply to #3:

Since the previous thread, https://www.advancedrenamer.com/forum_thread?for um_id=14903 I've been working on some way to accomplish that very action. Unfortunately, if there is a way to do it, it has escaped me and my meager scripting skills. I thought maybe the item.errorlevel / item.errorcode might be useful, but apparently that only effects the "current" or original directory.

If anybody out there has any thoughts on this I'd love to hear them; until then, I can't offer any help.

Best,
DF