On Fri, 02 Mar 2012 00:16:06 +0100 Florian Pritz <bluewind@xinu.at> 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.
Morning All Thanks for the scripts ect problem now solved and plenty of ideas stashed so that hopefully next time i dont need to holler for help . I maintain a web site for my local car club there is a large collection of photo's from the various events we do each year so it gets big and was in need of a bit of TLC .. Thanks Pete . -- Linux 7-of-9 3.2.8-1-ARCH #1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012 x86_64 AMD Phenom(tm) 9600B Quad-Core Processor AuthenticAMD GNU/Linux