filename.ext -> file\name.ext

A swapping-ground for Regular Expression syntax

filename.ext -> file\name.ext

Postby QDeath » Thu May 20, 2021 9:36 pm

Is it possible with BRU to parse a filename and create/move the file to a new directory based on the filename?

example: c:\path\to\stuff-MoreStuff.jpg -> c:\path\to\stuff\constant-MoreStuff.jpg
where stuff are digits
moreStuff are more digits
constant is a word that will note change

Any ideas? HELP!!!
QDeath
 
Posts: 3
Joined: Thu May 20, 2021 9:07 pm

Re: filename.ext -> file\name.ext

Postby QDeath » Fri May 21, 2021 1:03 am

c:\path\to\stuff-MoreStuff.jpg -> c:\path\to\stuff\constant-MoreStuff.jpg

Match.... c:\path\to\\s+-\d+.jpg
Replace... c:\path\to\\1\constant-\2.jpg

Will this work?
QDeath
 
Posts: 3
Joined: Thu May 20, 2021 9:07 pm

Re: filename.ext -> file\name.ext

Postby Luuk » Fri May 21, 2021 1:58 am

The settings will depend on which files should be moved, and how they are named, so this an example for...
Stuff ========== 1-or-more numbers
MoreStuff ====== 1-or-more numbers
Files to move === Anything named like 'Stuff-MoreStuff.jpg'
Constant ======= XXX

In the BRU menu, first to put a checkmark in "Renaming Options, Advanced Options, Allow Using '\' in Rename Criteria".
In Filters(12) to put a checkmark in 'RegEx', then a Mask like ^\d+-\d+.jpg$ then clicking the blue arrows by Mask.
In Regex(1) to use a Match and Replace like...
^(\d+)(-\d+)$
\1\\XXX\2

So this would move SomePath\11-444.jpg ===> SomePath\11\XXX-44.jpg
You dont need to double the \\ unless 'Constant' starts with a number, but its always a good habit.
Luuk
 
Posts: 320
Joined: Fri Feb 21, 2020 10:58 pm

Re: filename.ext -> file\name.ext

Postby QDeath » Wed Jun 16, 2021 2:56 pm

I checkmark the BRU menu to allow '\'. In Filters(12) when I put a checkmark in 'RegEx' and the mask ^\d+-\d+.jpg$ and click the blue arrows, the top right window is blank. It actually becomes blank once I put a checkmark in RegEx. HELP!!
QDeath
 
Posts: 3
Joined: Thu May 20, 2021 9:07 pm

Re: filename.ext -> file\name.ext

Postby Luuk » Wed Jun 16, 2021 3:26 pm

The Mask inside of Filters(12) will only match filenames like your example from the first post.
So if you have no files like that description, nothing will be presented inside of the file-listing.
If you have other filename formats to be matched, they must first be described.
Luuk
 
Posts: 320
Joined: Fri Feb 21, 2020 10:58 pm


Return to Regular Expressions