Removing certain words from Filenames

A swapping-ground for Regular Expression syntax

Removing certain words from Filenames

Postby EvylRat » Wed Dec 02, 2009 4:20 pm

I use a spam scanner to scan incoming emails at work. Another program saves the email in MSG format to our drives for archiving.
Our spam scanner, and sometime the sender's spam scanner appends words to the subject, which forms part of the filename.

examples (names removed)
2009-03-18_085809_RE [SPAM] - RE ATHENA POINT - Found word(s) list error in the Text body.msg
2008-10-09_150229_[SPAM] - Holford Industrial Estate, Unit 13 Refurbishment, Birmingham - Found word(s) free guaranteed in the Text body.msg
2008-09-19_115508_Out of Office AutoReply Unit 13 Holford.msg
2008-09-25_112545_Unit 13 - Holford [Scanned] [Spam score 8%].msg
2008-09-25_112545_Unit 13 - Holford [Scanned][Scanned].msg

I used to use Metamorphose to purge these but scanning an entire drive hangs the program.
I prefer BRU, but I cannot find the similar feature I'm looking for. Metamorphose can use RegEx to search for text in the filename, and you can remove this.
The example I used to use is
\[SPAM](\s-|\s|)|\s+-\sFound\sword.*(?=])|\s+-\sFound\sword.*(?=\d)|\s+-\sFound\sword.*|\s-\sEmail Found in Subject|(\s+|)\[Scanned]|(\s+|)\[Spam score\s\d+%]
But in BRU, I need to match AND replace, and since there's no pattern as to were these words I'm searching for end up, I'm a bit lost

Is it possible to search for multiple words using regex and simply remove them?

So far am searching for each individual term
(.*)(\[Scanned\]) replace with \1
(.*)(\[Scanned\])(.*) replace with \1\3
EvylRat
 
Posts: 2
Joined: Wed Dec 02, 2009 4:10 pm

Re: Removing certain words from Filenames

Postby Stefan » Wed Dec 02, 2009 8:31 pm

EvylRat wrote:Is it possible to search for multiple words using regex and simply remove them?


This was not possible in the past as long as i was used to use BRU,
but then this was planed to implement ==> http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=716

I still don't know if this is implemented in the meantime... just try this "trick" mentioned in that above shown thread.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Removing certain words from Filenames

Postby EvylRat » Wed Dec 02, 2009 10:44 pm

Stefan wrote:
EvylRat wrote:Is it possible to search for multiple words using regex and simply remove them?


This was not possible in the past as long as i was used to use BRU,
but then this was planed to implement ==> http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=716

I still don't know if this is implemented in the meantime... just try this "trick" mentioned in that above shown thread.


Thanks for this. This was the trick I used earlier, just ran several passes on files.
EvylRat
 
Posts: 2
Joined: Wed Dec 02, 2009 4:10 pm


Return to Regular Expressions