Many files in a directory (/root/path/
) have a strange character string appended to them (\#015
). Help me replace them with regular names without the strange string.
I need:
/root/path/img1.png\#015
/root/path/img2.jpg
/root/path/img3.png\#015
To be:
/root/path/img1.png
/root/path/img2.jpg
/root/path/img3.png
Can you help?
Remove all the files you don't want to edit by selecting them and pressing DEL, then right-click the remaining files and choose Open all. Now go to Search > Replace or press CTRL+H, which will launch the Replace menu. Here you'll find an option to Replace All in All Opened Documents.
for file in *\#015
do
mv -- "$file" "${file%\#015}"
done
You may need to escape the "\"s. Try it in a tmp directory first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With