[Linux-disciples] Deleting the first couple of characters of a
file name.
Stephen R Laniel
steve at laniels.org
Fri Feb 10 13:19:13 EST 2006
On Fri, Feb 10, 2006 at 11:18:11AM -0600, Karl Sokol wrote:
> I think that I am missing something. I tried each of the following...
>
> nahash at ubuntu:~/music$ rename 's/^\d{1,2}//' /home/nahash/music/*
> nahash at ubuntu:~/music$ rename 's/^\d{2}//' /home/nahash/music/*
> nahash at ubuntu:~/music$ find /home/nahash/music -type f -exec rename 's/^\d{2}//
> ' '{}' \;
> nahash at ubuntu:~/music$
>
> and still have have files like...
>
> 09 - Buddy Holly - Peggy Sue.mp3
Yeah, I dunno, it works for me:
(13:18) slaniel at bostoncoop:~$ mkdir foo
(13:18) slaniel at bostoncoop:~$ cd !$
cd foo
(13:18) slaniel at bostoncoop:~/foo$ touch '01 - a file with spaces.mp3'
(13:18) slaniel at bostoncoop:~/foo$ ls
total 8.0K
drwxr-xr-x 2 slaniel slaniel 4.0K 2006-02-10 13:18 .
drwxr-xr-x 22 slaniel slaniel 4.0K 2006-02-10 13:18 ..
-rw-r--r-- 1 slaniel slaniel 0 2006-02-10 13:18 01 - a file with spaces.mp3
(13:18) slaniel at bostoncoop:~/foo$ rename 's/^\d{2}//' *
(13:18) slaniel at bostoncoop:~/foo$ ls
total 8.0K
drwxr-xr-x 2 slaniel slaniel 4.0K 2006-02-10 13:18 .
drwxr-xr-x 22 slaniel slaniel 4.0K 2006-02-10 13:18 ..
-rw-r--r-- 1 slaniel slaniel 0 2006-02-10 13:18 - a file with spaces.mp3
(13:18) slaniel at bostoncoop:~/foo$
--
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20060210/87279101/attachment.pgp
More information about the Linux-disciples
mailing list