[thelist] bulk rename on Mac
Hassan Schroeder
hassan.schroeder at gmail.com
Tue Nov 23 13:44:28 CST 2010
On Tue, Nov 23, 2010 at 11:20 AM, Joel D Canfield <joel at bizba6.com> wrote:
> I have a folder packed with .asp files which I need to rename .php (yes, I
> changed the code inside already)
>
> mv *.asp *.php in Terminal seems like it should work, but only throws an
> error (well, not really, it just spits back "here's how to use mv")
ripple:/tmp$ ls *.asp
-rw-r--r-- 1 hassan wheel 0 Nov 23 11:41 1.asp
-rw-r--r-- 1 hassan wheel 0 Nov 23 11:41 2.asp
-rw-r--r-- 1 hassan wheel 0 Nov 23 11:41 3.asp
ripple:/tmp$
ripple:/tmp$ for arg in *.asp; do echo $arg | sed 's/.asp//' ; done
1
2
3
ripple:/tmp$ for arg in *.asp; do mv $arg `echo $arg | sed 's/.asp//'`.php; done
ripple:/tmp$ ls *.php
-rw-r--r-- 1 hassan wheel 0 Nov 23 11:41 1.php
-rw-r--r-- 1 hassan wheel 0 Nov 23 11:41 2.php
-rw-r--r-- 1 hassan wheel 0 Nov 23 11:41 3.php
ripple:/tmp$
Simplistic, hopefully adequate :-)
--
Hassan Schroeder ------------------------ hassan.schroeder at gmail.com
twitter: @hassan
More information about the thelist
mailing list