To rename a bunch of files with a suffix ".html" to ".txt" in the Mac Terminal, use this:
for file in *.html; do
mv "$file" "`basename $file .html`.txt"
done
As you can see in the link below, "basename" takes the leading part of a string as the first parameter and then the rest of the string as the suffix. In other words, the suffix does not need to be just the extension.
Source of solution:
No comments:
Post a Comment