[arch-general] renaming files

Mauro Santos registo.mailling at gmail.com
Thu Mar 1 18:20:53 EST 2012


On 01-03-2012 23:18, Mauro Santos wrote:
> On 01-03-2012 23: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 
>>
>> Thanks    Pete .
>>
>>
> 
> Assuming you don't mind bash scripts, maybe something like:
> 
> IF=$'\n?
> for file in *.jpg
> do
> mv "$file" "$(echo $file | cut -f1 -d\ )".jpg
> done
> 

Should be:
IFS=$'\n'

... a little late here, not making much sense now :/

-- 
Mauro Santos


More information about the arch-general mailing list