How do I add or remove spaces from filenames?

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

How do I add or remove spaces from filenames?

Postby PaulL » Sun Oct 09, 2016 7:26 am

I just installed your program. I would like to selectively add or remove spaces in all files in an extensive directory tree.

For example I would like to filter the tree for files matching *f*.xxx and then replace all filenames like
Code: Select all
*fqq.xxx
with
Code: Select all
* fqq.xxx
by adding a space before the "f" in each filename, or replace all filenames like
Code: Select all
*  fqq.xxx
with
Code: Select all
* fqq.xxx
by removing one of the two spaces before the "f" in each filename.
PaulL
 
Posts: 2
Joined: Sun Oct 09, 2016 6:41 am

Re: How do I add or remove spaces from filenames?

Postby therube » Sun Oct 09, 2016 4:40 pm

12:Filter
Code: Select all
Mask:  fqq\.
RegEx
Subfolders


3:Replace
Code: Select all
Replace:  fqq
With:  {space}fqq


---

If it's always (two) spaces:
Code: Select all
3:Replace
Replace:  {space}{space}
With:  {space}


If it's potentially more then two spaces:
12:RegEx
Code: Select all
Match:  (\S*)\s*(\S*)
Replace:  \1 \2

(Not entire sure about any of them, so check things out first ;-).)
therube
 
Posts: 316
Joined: Mon Jan 18, 2016 6:23 pm

Re: How do I add or remove spaces from filenames?

Postby KenP » Sun Oct 09, 2016 7:31 pm

This should work whether or not there are spaces immediately before the fqq and regardless of how many there are, it should also work if there are spaces elsewhere in the file name.

Filter (12)
Mask: fqq\.
Regex: selected
Subfolders: selected

Regex (1)
Match: (.*)(\w)(| | | *)(fqq)
Replace: \1\2 \4

Edit: I've just realised that the Regex Match can be simplified to Match: (.*)(\w)( *)(fqq)
KenP
 
Posts: 193
Joined: Sat Jul 30, 2016 11:25 am

Re: How do I add or remove spaces from filenames?

Postby PaulL » Sun Oct 09, 2016 11:45 pm

Thank you.
Using 12:Filter mask:F\. RegEx Subfolders produce a list of files.
Then I selected all the displayed files with Ctrl+A.
Then Using 3:Replace mask:F with:{space}F seems to work.
PaulL
 
Posts: 2
Joined: Sun Oct 09, 2016 6:41 am


Return to BRU Support