rename v. script
lsomike at futzin.com
Thu May 19 05:17:18 UTC 2005
On Thursday 19 May 2005 00:01, THUFIR HAWAT wrote:
> bash-3.00$ mv 1151154 1151154.html
> bash-3.00$ mv 1199229 1199229.html
> bash-3.00$ mv 1238181 1238181.html
> each file can be changed. however, there are many files and that
> is very tedious. can the above three commands (or 50, or 100) be
> written with a single rename command?
If all the files in the directory are to have the additional ".html"
suffix added then something like this may do:
for i in *; do mv $i `basename $i`.html; done
If you need to be more selective, you can fiddle with the first
section with the "*". For example, to rename only the files
beginning with the number "1":
for i in 1*; do ........
or files beginning with any number:
for i in [1-9]*; do .....
Regards, Mike Klinke
More information about the users