mass rename help

kitepilot at kitepilot.com kitepilot at kitepilot.com
Mon Oct 29 21:23:44 MST 2012


Dazed_75 writes: 

> I have a bunch of files named "meetthegimp=mobile999.mp4" where 999 is any
> 3 digit number.  I want to rename them all to be
> "meetthegimp999-mobile.mp4".
-------------- next part --------------
WoW, cool commands, didn't know any of them, that's why I like this list...   :)

I'm lazy to learn new stuff though, and untrusty of any brick I didn't build, so I'll chip in my simple (to me) solution:

ls|while read FILE;do
    echo "mv $FILE $(echo "$FILE"|sed -e 's/\(meetthegimp\)=\(mobile\)\([[:digit:]]*\)\(\.mp4\)/\1\3-\2\4/g')"
done > /tmp/junk.cmd

Inspect /tmp/junk.cmd and:

. /tmp/junk.cmd

Eat your banana...   :)
ET


More information about the PLUG-discuss mailing list