How can I remove a string of text from a files name?
By Gabriel Cooper •
Following this question I exported various SVGs to PNGs, but there is a little problem, all files include in their name the extensions .svg and .png as in file.svg.png.
Now what I'd like to know is how can I remove the .svg string from the name of the file without going trough each file and do right-click>rename?.
2 Answers
I guess this answer to another question could help :)
Specific to the question:
rename s/".svg"/""/g *
General:
rename s/"**TO-BE-REPLACED**"/"**REPLACEMENT**"/g *
pyrenamer is a pretty handy tool for batch renaming files. Otherwise, you could always fire up the terminal.
for file in *; do mv "${file}" "${file//\.svg/}"; doneThat should do the trick if you're in the same directory as the pictures. Use at own risk.
0More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"