Hi,
Novice to scripting. I need to trim 2 characters on the left side of a filename. What's the syntax and where do I execute it? Also, can the code be used when using F2 (Batch rename)?
Thanks for your help!
Trim file name on left side
Re: Trim file name on left side
Code: Select all
renameitem(substr(gpc(, "base"), 2), , 1);
whatever you like...
Code: Select all
Also, can the code be used when using F2
One of my scripts helped you out? Please donate via Paypal
Re: Trim file name on left side
Hey Highend,
Thanks for the help.
Thanks for the help.
Re: Trim file name on left side
For multiple items:
Code: Select all
foreach($item, <get SelectedItemsPathNames |>, , "e") { renameitem(substr(gpc($item, "base"), 2), $item, 1); }
One of my scripts helped you out? Please donate via Paypal
Re: Trim file name on left side
foreach($item, <get SelectedItemsPathNames |>, , "e") { renameitem(substr(gpc($item, "base"), 4), $item, 1); only worked on the first filename because the closing brace ("}") is missing. Now it works great. Thanks for the script.
Re: Trim file name on left side
Welcome to the forum!
The closing bracket wasn't missing, thus the horizontal scrollbar and that's also where the "Select All" button comes in handy.
The closing bracket wasn't missing, thus the horizontal scrollbar and that's also where the "Select All" button comes in handy.
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)