[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

.HTM -> .htm




To the guy that asked how to change the capitalization of his HTML files that he transported from Windows. Sorry I'm not replying your message directly.

If all you need is changing the filenames you can do it easily with the following command:
$ for i in *.HTM; do mv -i `basename "$i" HTM`htm; done
The `-i' is there to have mv ask for confirmation before silently overwriting existing files.

If you have a deeper directory structure, you could instead do:
$ find . -name '*.HTM' -print0 | sed 's/.HTM//g' | xargs -0 -l -iXX mv -i XX.HTM XX.thm Sorry, but this one will get confused if you have the ".HTM" in the middle of your file names; for instance, weird.HTM-file_name.txt.

If you have to change the actual contents, then I'll give you one more oneliner, but know that it will change ALL occurrences of .HTM into .htm, it will not look at context information (ie., it will change text also out of A href attributes):
$ find . -name '*.HTM' -print0 | xargs -0 sed -i 's/\.HTM/.htm/g'

Hope it helps. Use the information provided at your own risk.

--
Javier Kohen <jkohen@users.sourceforge.net>
ICQ: blashyrkh #2361802
Jabber: jkohen@jabber.org



Reply to: