[Gllug] Swapping two parts of a filename...

Dylan dylan at dylan.me.uk
Wed Jun 2 22:40:44 UTC 2004


On Wednesday 02 Jun 2004 23:31 pm, Mike Brodbelt wrote:
> On Wed, 2004-06-02 at 22:59, Dylan wrote:
> > Hi All,
> >
> > I have a bunch of mp3's with filenames like:
> >
> > Track Name - Artist Name.mp3
> >
> > which I'd really rather like as
> >
> > Artist Name - Track Name.mp3
> >
> > Is there an easy way to accomplish this? I also need to handle
> > cases where the track name or artist name contains a hyphen (in
> > which case, it would have a non-space character on each side.)
>
> Something like:-
>
> $ touch "Track Name - Artist Name.mp3"
> $ ls
> Track Name - Artist Name.mp3
> $ /bin/ls -C1 | sed "s/\(.*\) - \(.*\).mp3/mv \"&\" \"\2 -
> \1.mp3\"/"|sh $ ls
> Artist Name - Track Name.mp3
>
>
> Adjust your regex to fit...

Well, I'll trust it does what you say (will try it on a test file 
first!) but it looks like gobledygook to me so adjusting the expression 
to fit will be fun!

Cheers

Dylan

>
> HTH,
>
> Mike.

-- 
"I see your Schwartz is as big as mine" 
                                  -Dark Helmet
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list