web.onassar.com Archive

I can be reached at onassar@gmail.com.

For my open source work, check out github.com/onassar

Mass svn rename for files

View more posts

Ran into a hurdle whereby I needed to convert maybe 30+ xml files to a JSON extension. But I needed to run them through svn mv rather than just a mv statement.

After a bit of help and playing around found this gem:

for file in *.xml;
   do svn mv $file `basename $file xml`json;

This simply loops through the xml files in the directory, strips out the extension via the basename program/application/utility, appends the JSON extension and svn mv's it.

I heart bash.