Assigning text to be used in folder name and file name

Advanced Renamer forum
#1 : 16/08-24 14:49
Anders
Posts: 1
Hi,
I use a naming regime for my photos:

YYYY\YYYY MM text\YYYY MM text #### as in

2024\2024 07 Holiday\2024 07 Holiday 0001

I would like to enter the "text" (Holiday) only once and move files from SD card to a folder and rename them in one go. Can I name folders from a script value to do this?

(I am migrating from Cam2PC which could handle this, but was not updated since 2015 - in Cam2PC I could also transfer files from multiple months, based on the monyh of the first file in the list, and I could have a counter in the folder, so a second import to a folder would add from where the first started - it does not seem to match Advanced Renamer use cases, but if it is possible I'd like to hear).
Anders
#2 : 16/08-24 16:03
Delta Foxtrot
Posts: 296
Reply to #1:

Hi Anders, welcome,

This script will do what you want, at least the first part of your question. At least it will if the tags I've used, which seem to work on most files, work on YOUR files.

-----------------------------------------------------------------------------------
newText = "Holiday" ;
newPath = app.parseTags( "M:\\" + '<Year Created>' + "\\" + '<Year Created>' + " " + '<Month Created>' + " " + newText + "\\" ) ;
item.newPath = newPath ;
newName = app.parseTags( '<Year Created>' + " " + '<Month Created>' + " " + newText + " " + '<IncNrDir:0001>' ) ;
return newName ;
-------------------------------------------------------------------------------
Copy the script (between the dashes, of course) and paste into a new script method. Change the first line to include whatever text you want.

The first time you use it you'll have to change the drive letter for your drive. As written the script puts the new subdirectories in the root directory of drive M: ; tell me if you want it to start in a subdirectory and I'll tell you how to modify it. Or just play around with it. :)

As to your second question, you'd have to change the '<IncNrDir:0001>' in the second-to-last line to start with the correct sequential number (or you can set the "Name collision rule" to do something else, but that wouldn't give you exactly what you asked for).

Here's a screenshot of my ARen using this script on a few test files:
https://drive.google.com/file/d/13LhqfHaV6QkiuoH F8nC3qcoFmjsFpbfH/view?usp=sharing

(Be sure to test this out on small batches of files first, and remember you can always undo any batch run)

Hope this helps, and good luck!

Best,
DF

edited: 16/08-24 16:22
#3 : 17/08-24 15:37
Delta Foxtrot
Posts: 296
Reply to #2:

On further testing I've had some problems with renaming files from multiple directories. Changing the "<IncNrDir:0001>" to "<IncNr:0001>" fixes that (again, if you already have files in the output directory you'll need to adjust the "0001" in that tag to [last number already in the directory + 1], but I believe ARen will warn you if that's about to happen).
#4 : 20/08-24 04:30
Nikky
Posts: 9
Thanks!

edited: 20/08-24 04:44