Monday, December 8, 2014

[Linux] rename extensions of multiple files

For example, change *.html into *.txt.
In Linux,
one can directly type the following in the prompt:
rename .html .txt *.html

or use bash script
for file in *.html; do
    mv "$file" "`basename $file .html`.txt"
done
for files in *.html
do
 mv "$files" "${files%.html}.txt"
done

No comments:

Post a Comment