Output folder based on part of filename

Advanced Renamer forum
#1 : 01/07-20 21:21
Jesper Bing
Jesper Bing
Posts: 2
I'm trying to move images to subfolders based on their filename.
The images are currently stored in the folder "trips".



Must be moved to: trips/trip-to-malaga-2017


Must be moved to: trips/trip-to-italy-2017

So, I must remove the last hyphen plus the digits from the filename, but how?

01/07-20 21:21
#2 : 01/07-20 23:31
David Lee
David Lee
Posts: 497
Use the Move Files Batch mode and set the New Path in a Script method using a Regular Expression.

To create the new folders witin the existing folder enter this code into a Script window.

item.newPath = item.path + item.name.match(/^.*(?=-.*$)/) + "\\";

Noe that you don't need a return statement.

01/07-20 23:31
#3 : 02/07-20 18:13
Jesper Bing
Jesper Bing
Posts: 2
Reply to #2:
Thank you very much.

02/07-20 18:13