Move n files to new incremental folder

Advanced Renamer forum
#1 : 23/05-19 14:23
Tyler
Tyler
Posts: 1
I have multiple images in a folder and need to move every n images into a newly created folder:

eg: every 8 images to one new folder

Image_001 -> /folder1/
Image_002 -> /folder1/
Image_003 -> /folder1/
Image_004 -> /folder1/
Image_005 -> /folder1/
Image_006 -> /folder1/
Image_007 -> /folder1/
Image_008 -> /folder1/
Image_009 -> /folder2/
Image_010 -> /folder2/
Image_011 -> /folder2/
Image_012 -> /folder2/
Image_013 -> /folder2/
Image_014 -> /folder2/
Image_015 -> /folder2/
Image_016 -> /folder2/
Image_017 -> /folder3/...


Thanks


23/05-19 14:23
#2 : 23/05-19 16:48
David Lee
David Lee
Posts: 261
You can do this in two steps:
(1) Append the sub-folder numbers to the filenames using a script
(2) Move the files and remove the added numbers

(1) Select Batch mode: rename and add a Script method with the following script...

var n = app.parseTags("<Substr:'_':5>");
if (!isNaN(n)) {
n = "#" + (parseInt((n - 1) / 8) + 1);
} else {
n = "";
}
return item.newBasename + n;

During execution of the Batch, in the Progress dialogue, select Add files: All items

(2) Deselect the Script method, select Batch mode: Move
Output folder: folder<Substr:"#":1>

and at the same time...

Add a Remove pattern method...
Pattern: #.*
Use regular expressions



23/05-19 16:48