Adding an extension to file names

Post any Bulk Rename Command support requirements here. Open to all registered users.

Adding an extension to file names

Postby gordon_c » Tue Oct 04, 2011 1:50 pm

I have a Folder with 25 Subfolders which house about 750 files.
All these files are in .rtf format.
However, the filenames do not have the .rtf extension.
(If I "tell" Windows they are .rtf they will open satisfactorily,
But I would have to do so for every file.)
Can I ADD the extension to all these files (at a single shot) using the Section 11
of the BRU by entering .rtf and pressing RENAME ?
gordon_c
 
Posts: 1
Joined: Tue Oct 04, 2011 1:14 pm

Re: Adding an extension to file names

Postby Jane » Fri Oct 21, 2011 10:51 pm

This should probably be posted in BRU support rather than command line.

The simplest way I can think of to add extensions is to use the Regex(1) section

Match: (.+)
Replace: \1.rtf

This will do the job, but it only works properly on files that have no extension.
If they do you end up with a double extension.

If you have a mixture of some with extensions and some without, use the following:

Match: ^([^.]+)$
Replace: \1.rtf

This only matches files that contain no extension dot and will ignore and not add .rtf to any files having an extension.

Make sure Include Ext. box is checked!

Give it a try,
Jane
Jane
 
Posts: 24
Joined: Sat Aug 05, 2006 1:20 am


Return to BRC Support