If you are using Linux, you should have the "rename" command, which lets you use wildcards to do some simple renaming.
If you are using some other Unix, you may not have "rename", or even if you do, whatever you want to do may be too complex for that. In that circumstance, you can't do it as you would in DOS, but you can do it.
If using Windows, Randi suggested biterScripting, a free Windows scripting tool (there are others, including Microsoft's own offerings).
Back to Unix and Linux: First, the "mv" command is what renames a file- you are "moving" it to a new name.
To rename with wildcards, you need to write a simple shell script. This can be done with any shell, but shells like ksh make it easier. For example, here's a couple of scripts to rename a bunch of uppercase file names to lowercase:
# [A-Z]* matches upper case names for i in [A-Z]* do j=`echo $i | tr '[A-Z]' '[a-z]'` mv $i $j done
Note the backtics ("`") carefully.
With ksh this becomes easier:
#!/bin/ksh typeset -l j for i in [A-Z]* do j=$i mv $i $j done
If you found something useful today, please consider a small donation.
Got something to add? Send me email.
We are questioning more than the philosophy behind our dependence upon limited and limiting systems. We question the power structures that have grown up around such systems. (Frank Herbert)