Re: renaming files

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



On 02.03.2012 00:16, Florian Pritz wrote:
> On 02.03.2012 00:13, pete wrote:
>> Hi folks 
>> 
>> Bit sort of off topic but hopefully ok 
>> 
>> I have some 350 picture files  with names  along the lines of
>> "IMG_7127 EOS-1D Mark III copy.jpg"    i would like to rename them all
>> to more like "IMG_7127.jpg"  i have tried a few times tonight and cant
>> get my head around it anyone got a script that can do it 
>> 
> 
> If the string is always the same use this:
> 
> rename " EOS-1D Mark III copy" "" *.jpg
> 
> If not:
> 
> for file in *.jpg; do
>   mv "$file" "$(echo "$file" | sed 's/regex here//')"
> done
> 
> This won't be fast, but it gets the job done.
> 

Totally forgot about perl-rename there.

perl-rename 's/regex here//' *.jpg

-- 
Florian Pritz

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux