//View Tip #140
Similar Tips
» Find last modified files on a filesystem
» ssh proxy forwarding
» Counts files in the current directory and subdirectory
» Create a Terminal Calculator
» swap files

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
To change the extension on a group of files using only bash builtins and mv:

for i in *.txt; do mv $i ${i%%.txt}.html; done


View Comments »



Comments 

Add your comment

CAPTCHA

No HTML allowed. URLs will be linked with nofollow attribute. Whitespace is preserved.

you forgot the quotes:

 for i in *.txt; do mv "$i" "${i%%.txt}".html; done

also see: http://www.shell-fu.org/lister.php?id=27
Posted 2009-02-14 19:10:17

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit