[ale] quick renaming hiccup help

David Tomaschik david at systemoverlord.com
Wed Nov 30 11:05:00 EST 2011


On Wed, Nov 30, 2011 at 10:55 AM, Michael B. Trausch <mike at trausch.us> wrote:
> On Thu, Nov 24, 2011 at 12:37:47PM -0500, mute wonder wrote:
>> I tried to remove part of a common pattern from a group of folders
>> with a quick 'rename' command.  It didn't work.
>>
>> Within the same folder, several subfolders have names containing "
>> -- Jamendo - MP3 VBR", and I wanted to remove everything in the
>> names that began with that string.  So, I tried the rename command:
>>
>>  rename \ --\ Jamendo* _folder *Jamendo\ -\ MP3*
>>
>> And this tacked the intended replacement text, "_folder" onto the
>> end of the intended removal text, " -- Jamendo*", but it managed to
>> match all the intended folders.  So escaping the spaces seemed to
>> work only part of the time.  Why?
>
> I am guessing that you meant "mv" here...
>

Believe it or not, he probably did mean "rename".  There's actually
more than one "rename" out there.  On RHEL/CentOS, it's a program that
basically takes argv[3] and does a s/argv[1]/argv[2]/ on it.  As to
why it matched all folders, I'm not sure, but the use of single vs
double dashes in the command above might have something to do with it.

As an aside, on Ubuntu, rename is actually "prename" which is a perl
script that executes a perl expression on each filename before
renaming it to the return value of that expression.  Gotta love
incompatible programs under the same name (and I don't just mean the
busybox version vs the GNU version vs the BSD version, like for ps or
something).


-- 
David Tomaschik, RHCE, LPIC-1
System Administrator/Open Source Advocate
OpenPGP: 0x5DEA789B
http://systemoverlord.com
david at systemoverlord.com



More information about the Ale mailing list