coding/renamefiles

renamefiles is a simple tool to rename multiple files at once. In contrast to the "rename" tool, that comes with many distributions, renamefiles supports recursion as well as replacing text file content.

usage examples

This website was programmed using JSP. However I didn't want to run Apache Tomcat or some other JSP server (for security reasons as well as it wasn't really needed). Thus I ran "wget -m -k -nH" on the local website.
wget however doesn't change the file suffixes from "jsp" to "html". To do exactly this and also change the links to the new files, you could use:
renamefiles -r -F -C -A "\.(html|jsp)$" -v "[\.]jsp" ".html" <directory>

Alternatively you could also use the wget -E option, but you might soon find out, that it will just add a suffix to the jsp files instead of replacing the old suffix. Moreover it will add an html suffix to many non-html files.

To remove css comments, you could use:
renamefiles -r -C -A "\.css$" -v "\s*/\*[^\*]*\*/\s*" "" <directory>
(Note, that the regex is imperfect: It doesn't catch comments containing *)
or to remove html comments, you could use:
renamefiles -r -A "\.html$" -C "<!--[^>]*-->" "" <directory>

You can also remove unnecessary whitespace from the css and html code or do whatever else you got in mind...

summary

versionplatformlicenselanguagedependenciestranslationsuser interfacemaintaineddownloadtype
0.7independentGPLv3C++≥ Qt 4.6Englishconsoleyesheresource