[Linux-disciples] Deleting the first couple of characters of a file name.

Adam Rosi-Kessel adam at rosi-kessel.org
Fri Feb 10 13:23:16 EST 2006


Try it with 'rename -v', that will give you more output.

Stephen R Laniel wrote:
> 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$
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20060210/5c4c4e60/signature.pgp


More information about the Linux-disciples mailing list