Re: rename v. script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



THUFIR HAWAT wrote:

given:

bash-3.00$ ls -al
total 984
drwxr-xr-x   2 thufir thufir  4096 May 16 02:18 .
drwx------  15 thufir thufir  4096 May 16 02:18 ..
-rw-r--r--   1 thufir thufir 12354 May 14 22:30 1151154
-rw-r--r--   1 thufir thufir 12955 May 14 22:16 1199229
-rw-r--r--   1 thufir thufir 13639 May 14 22:22 1238181
-rw-r--r--   1 thufir thufir 13996 May 14 22:24 1268816
-rw-r--r--   1 thufir thufir 12176 May 14 22:37 1276032
...

and then:

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?

thanks,

Thufir



#!/bin/sh
for a in `/usr/bin/ls `
 do
 b=$a.html
mv $a $b
done


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux