On 3/6/06, Andrew Lentvorski <[EMAIL PROTECTED]> wrote:
> Karl Cunningham wrote:
> > I'm trying to write a bash script to distribute some music files from
> > one directory to various subdirectories based a correlation between the
> > file and directory names. The files are mp3s and almost all contain
> > spaces in the filenames. The filenames are of the form:
> >
> > artist - title.mp3
> >
> > The directories are named to correspond to the artist names. For each
> > directory found the script should move all mp3 files that start with the
> > same text as the directory name into the corresponding directory. For
> > instance, a file named 'Bob Dylan - Subterranean Homesick Blues.mp3'
> > should get moved into the './Bob Dylan' directory. I tried the
> > following but everything winds up in the root directory. Any help is
> > appreciated.
>
> First, I wouldn't use shell. Shell is basically for boot scripts and
> setting environment variables. After that, use a "real" language like
> Perl, Python, etc.
>
> Second, come on people, there is a program to do this. It's the Swiss
> Army Knife of renaming. It was originally Unix but finds especially
> heavy use on Windows because Windows is so crummy at renames and copies.
> The Windows pr0nm31sters love it.
You are probably thinking of a program named "rename". Unfortunately,
there are (at least) two different things that go by that name, and
they are not interchangeable. One is a Perl script, the other isn't.
This is the one that isn't, it comes with Fedora Core:
[EMAIL PROTECTED] $ file $(which rename)
/usr/bin/rename: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs),
stripped
carl
--
carl lowenstein marine physical lab u.c. san diego
[EMAIL PROTECTED]
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list