Folder creation

Advanced Renamer forum
#1 : 04/02-21 17:31
James
Posts: 2
Hi,

Is there a way with this that I can it to look a list of files and create a folder based on the first 7 characters and move the files into the folder automatically after renaming them?

Thanks

James

edited: 04/02-21 18:19
#2 : 04/02-21 18:49
David Lee
Posts: 1125
You can select a New Path for each file using a script method with the following code:

item.newPath = item.path + item.name.slice(0,7);

This will move each file into a sub-folder within the existing directory named according to the first characters of each filename, up to a maximum of 7 characters.

You can rename the files within the same script or using any renaming method.

If you want to use the first 7 characters of the new name then use the code:

item.newPath = item.path + item.newName.slice(0,7);

If you have files with shorter names that you do not wish to move then you will require some extra code to check the filename length.

edited: 04/02-21 18:53
#3 : 05/02-21 16:52
James
Posts: 2
Reply to #2:
thanks a lot.