DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Change File Extensions With Bash Shell

05.03.2005
| 63277 views |
  • submit to reddit
        To change all .htm files in a folder to .html files:

for f in *.htm; do mv $f `basename $f .htm`.html; done;
    

Comments

Snippets Manager replied on Thu, 2009/03/12 - 12:19pm

If you've got spaces in your filenames, this is a more fullproof version: for f in *.MP3; do mv "$f" "`basename "$f" .MP3`.mp3"; done;