Rename Filename to match the Folder name

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

Rename Filename to match the Folder name

Postby rmarkables » Sat Jul 27, 2019 11:00 pm

Hi

I have a requirement to rename the file in a folder to match the folder name. I was wondering if anyone here on the forum has any ideas how to accomplish this.

Thanks
Rmarkables
rmarkables
 
Posts: 2
Joined: Sat Jul 27, 2019 10:53 pm

Re: Rename Filename to match the Folder name

Postby Admin » Mon Jul 29, 2019 12:07 am

Javascript code for BRU JavaScript renaming :

Code: Select all
var myString = object("folder");
var pathElements = myString.split('\\');
var lastFolder = pathElements[pathElements.length - 2];

newName = lastFolder;
Admin
Site Admin
 
Posts: 1622
Joined: Tue Mar 08, 2005 8:39 pm

Re: Rename Filename to match the Folder name

Postby rmarkables » Thu Aug 01, 2019 6:32 pm

Wow !!

Thanks a million

Mark
rmarkables
 
Posts: 2
Joined: Sat Jul 27, 2019 10:53 pm


Return to Javascript Renaming