How can I strip out some text from filenames in a folder?
I'm currently attempting:
rename s/"NEWER_(.*?)"//g *
But nothing it getting renamed
I have a parent folder, with a bunch of sub-folders, within are files, that OneDrive thought would be a great idea to append a " (NEWER_timestamp)" to, and I'd like to remove that.
Example File Names:
getyou.ico (NEWER_1417529079.87)
o7pm.ico (NEWER_1417529184.89)
o7th.ico (NEWER_1417529135.81)
Best Answer
Try the following:
[^/]*(.*) .*$
matches only the last part of the path that doesn't contain a/
. And(.*)
is a group of matching everything after last/
and before a space. Its back-reference will be
$1
..*$
matches everything to end$
of files name after space.s/.../REPLACEMENT/
, we just kept the matched group that is between last\
and a space(.*)
which is known as group of matches.