trying to truncate files only at the start of a string

A swapping-ground for Regular Expression syntax

trying to truncate files only at the start of a string

Postby wildpetals » Thu Aug 07, 2014 7:48 pm

hi...

unfortunately, hit by krypto.. so had to restore all my files.

all restored files have at the end of their file name: (Restored) xx-xx-xxxx.file extension the xx are dates which can vary
the original files are still in the directory too.

so first, i have to prepend DELETE to any file that does not have (Restored) in the file name

Then, I am trying to truncate where (Restored starts. If krypto had killed all my files, that would have been better. But it only killed some of the files. for instance .zip files were not affected. So those were not restored. (I was not involved in the beginning of this part)

Anyhow... this is what I am trying to do:

the old files are there ... so we are trying to prepend "DELETE" before those files.

go into explorer, and delete those files so that a rename will work properly for the files that have (Restored) in the file name.

I want to leave alone any file that does not have (restored) in the file name

So far, I can put the regex to find restored... and delete the last 28 characters of the file name. This works except it deletes the last 28 characters of files that don't have (Restored) in them.. which is bad. :)

how can i get the BRU to recognize the regex for the (Restored) and only remove the last 28 characters that have (Restored) in the file name?

Thanks so much for your assistance

smiles your way... laura
wildpetals
 
Posts: 1
Joined: Thu Aug 07, 2014 7:39 pm

Re: trying to truncate files only at the start of a string

Postby Stefan » Fri Aug 08, 2014 10:04 pm

If you have created the regular expression correctly, only file with "(Restored)" in it would be affected, as only on them the regex would match.

But you can also try

Selection(12)
Filter: *(Restored)*



 
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU


Return to Regular Expressions