Changing file NAMES with regex

30 views
Skip to first unread message

LUCA LORENZO Bonatti

unread,
May 8, 2022, 7:55:49 AM5/8/22
to BBEdit Talk
Hello, is there any way to change, not the content of all files in a folder, but the NAMES of all files in a folder, by using BBedit directly and regex?

Thanks if you have any pointer.
l.

Jeffrey Jones

unread,
May 8, 2022, 12:05:10 PM5/8/22
to bbe...@googlegroups.com
On 2022 May 8, at 04:20, LUCA LORENZO Bonatti <luca.b...@upf.edu> wrote:
>
> Hello, is there any way to change, not the content of all files in a folder, but the NAMES of all files in a folder, by using BBedit directly and regex?

This is a good application for a Shell Worksheet.

Make two lists of the files. Apply your changes to one list. Paste the changed list as a second column after the unchanged list. Prepend each line with "mv ". Execute the block.

jj

unread,
May 8, 2022, 3:53:07 PM5/8/22
to BBEdit Talk
Hi Luca,

For renaming folder contents with regular expressions I would recommend the command line utility rename.

You can install it from Homebrew. In the terminal:

    % brew install rename
   
And for help:

    % man rename
   
HTH,

Jean Jourdain

Sam Birch

unread,
May 8, 2022, 6:35:41 PM5/8/22
to BBEdit Talk

On 8 May 2022, at 4:20, LUCA LORENZO Bonatti wrote:

Hello, is there any way to change, not the content of all files in a
folder, but the NAMES of all files in a folder, by using BBedit directly
and regex?

qmv from renameutils or vidir from moreutils can help you here, but allowing you to edit a folder’s contents using the editor of your choice.

Both can be installed with Homebrew:
https://formulae.brew.sh/formula/renameutils
https://formulae.brew.sh/formula/moreutils

Cheers,
-sam

Greg Raven

unread,
May 9, 2022, 8:11:15 AM5/9/22
to BBEdit Talk
I recommend NameChanger - MRR Software - https://mrrsoftware.com/namechanger/

Patrick Woolsey

unread,
May 9, 2022, 9:27:15 AM5/9/22
to bbe...@googlegroups.com
On May 08, 2022, at 04:20, LUCA LORENZO Bonatti <luca.b...@upf.edu> wrote:
>
> Hello, is there any way to change, not the content of all files in a folder, but the NAMES of all files in a folder, by using BBedit directly and regex?
>
> Thanks if you have any pointer.


Since BBEdit does not have built-in support for modifying file properties[*], you would need to use a separate tool; my favorite is Name Mangler:

<https://manytricks.com/namemangler/>


[*: As other folks have already pointed out, you may however be able to use a shell worksheet, or a script, or a command-line tool to apply the desired name transformations.]


Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <https://www.barebones.com/>

Reply all
Reply to author
Forward
0 new messages