renaming marked/unmarked subfolder level 3+

Bulk Rename Utility How-To's

renaming marked/unmarked subfolder level 3+

Postby seanprice » Thu Jun 01, 2023 5:44 pm

Hello forum! I didn't quite understand how I can do the following with this great tool for batch renaming.
#1
Rename 3rd subfolder {subf3} and beyond to keep only the first 4 characters of its original name?
c:\{rootf} \ {subf1} \ {subf2} \ {subf3} \ {subf4} \ {subf5}

original:
c:\long pathR \ long path1 \ long path2 \ long path3 \ long path4 \ long path5
result:
c:\long pathR \ long path1 \ long path2 \ long \ long \ long

#2
Perform subfolder rename as defined in #1 for all {rootf} (root folders) in drive c:\ except those prefixed with "S" (for skip).
skipped folders examples: c:\Sdocs, c:\Spics

#3
Perform subfolder rename as defined in #1 only on {rootf} (root folders) in drive c:\ prefixed with "P" (for process).
processed folders: ie. c:\Pdocs, c:\Ppics

Thank you!
seanprice
 
Posts: 1
Joined: Thu Jun 01, 2023 4:34 pm

Re: renaming marked/unmarked subfolder level 3+

Postby therube » Fri Jun 02, 2023 5:23 pm

JavaScript renaming, I'd think, could do that?
(How, is beyond me.)
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Rename folders 4-or-more deeper than C:

Postby Luuk » Fri Jun 02, 2023 10:43 pm

#1: With the paid version, can type C:\ in the folder-path, with Filters(12) having checkmarks for "Folders" and "Subfolders".
Then javascript could rename any of your folders that are 4-or-more deeper than C: with something like...
if (/^([^\\]+\\){4,}$/.test(object('folder'))) {newName=name.substring(0,4)}

#2: To conduct everything in #1, but only when {rootf} starts with "P" ...
Can either edit this code, or just add a Filters(12) "Condition" like... /C:\\P/.test(object('folder'))
Then clicking the blue-arrows inside of Filters(12) will only present these folder-names inside of the file-listing.

#3: To conduct everything in #1, except when {rootf} starts with "S" ...
Can again edit the code, or just add a Filters(12) "Condition" like... /C:\\[^S]/.test(object('folder'))

For myself, I do usually like to edit the main code, instead of adding Filter(12) Conditions for the file-listing.
But its because Im usually wanting to also present everything that's not getting renamed by the main code.
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: renaming marked/unmarked subfolder level 3+

Postby Admin » Sat Jun 03, 2023 2:43 am

Hi, Javascript renaming will do that as it can check the number of folders in a path and rename the folder.
But you need a commercial license for BRU to unlock javascript.
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm


Return to How-To