RTTSoftware Support Forum
PDF-ShellTools => General => Topic started by: Nick Riviera on November 13, 2020, 02:52:37 PM
-
Hi,
Does PDF-ShellTools have capability to rename files with folder name..?
ex:
folder name:
"November2020"
files that are in this folder:
"November2020_01.pdf"
"November2020_02.pdf"
"November2020_03.pdf"
...
Thank you very much.
-
You can do it with the renamer tool (https://www.rttsoftware.com/Manuals/STIndex.htm?pageURL=ST/English/Renamer.htm).
You need to add a script function that will be used to get the folder name. To do that, open the scripts editor, functions menu Scripts>Manage scripts, and create a new script called FolderName with this code in it:
function FolderName() {
var parts = BatchFile.Filename.split('\\');
return parts[parts.length - 2]
}
Or, from the script editor main menu, import the attached FolderName.myscript file.
Close the script editor, saving the changes.
You can now set a rename formula like this:
[FolderName]_[Counter:1|1|2|A]
To get file names as in your example.
-
Thank you!!!