• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

What's the *NIX'y way to rename multiple files?

cleverhandle

Diamond Member
OK, CLI gurus... I've got about 30 .ent files that need to be renamed as .gml files. I only have the console. What's the clever string of tools I need to do this quickly?
 
Originally posted by: CTho9305
does "mv *.fdsa *.asdf" not work?

Unless you are using some funky version of mv (or some different shell), that won't work. MS DOS's move will let you do that, but not /bin/mv. In any case, a simple shell script like the following would work:


#!/bin/sh
for i in *.ent
do
mv $i `basename $i ent`gml
done


This should also work with bash.

 
mv won't work because it expects that multiple files will always have a directory as a final argument.

The for loop does work, though the rename command is, not surprisingly, a little easier to use. Thanks for the lesson in basename usage, though - I'm sure that will come in handy at some point.
 
Back
Top