I\'d like to take a directory and for all email (*.msg) files, remove the \'RE \' at the beginning. I have the following code but the rename fails.
opendir(D
I don't know if the regex fits the specifig name of the files, but in one line this could be done with:
perl -E'for (){ ($new = $_) =~ s/(^RE)(.*$)/$2/; say $_." -> ".$new}
(say ...
is nice for testing, just replace it with rename $_,$new
or rename($_,$new)
)
<*.*>
read every file in the current directory($new = $_) =~
saves the following substitution in $new
and leaves $_
as intact(^RE)
save this match in $1 (optional) and just match files with "RE" at the beginning(.*$)
save everything until and including the end ($) of the line -> into $2$2