[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: file extensions



> This worked in my "test" directory, but once I became root and tried
it, it seemed to

Why did you have to become root? It sounds like you need to use the uid
and gid options in the fstab entry for your windows partition.

> only mess with my "locate" command.... I say this because before
running it "locate
> *.MP3" would result in a quick list of these files.  But after
running that command
> in a directory with .MP3's, typing "locate *.MP3"  slowly scrolls out
the list of
> .MP3's in that directory.  "locate .MP3" works fine, but mmv did
alter the behaviour
> locate.  Also updatedb gave me this when it finished.

Interesting experiment. Here's what's happened:

locate(1)'s database has the filenames that the kernel's vfat driver
reported, which is what you get in a directory listing, what you see in
Windows, and, not coincidentally, the exact strings used to identify
the
file in the filesystem (except that the fs uses 2-byte chararcter
codes,
but that's not important to us English-speaking Americans :-). I think
that explains the behavior you got the first time you ran locate.
Because vfat doesn't differentiate case, the mmv command had absolutely
*no effect*. The reason `locate *.MP3' behaved differently is that you
ran it in the directory of the mp3's, so the shell expanded your
fileglob to a listing of the `*.MP3' files in that directory, and
locate
did a *separate* search for each one (and found them).

First of all, always protect locate's args from the shell, e.g.:
locate '*.MP3'
or:
locate \*.MP3

'man bash' for more.

To *fix* this, just say this to bash in the directory of your mp3s:

for x in *.MP3;do mv -iv "$x" foo;mv -iv foo `echo "$x"|sed -e
's/MP3$/mp3'`;done

(It's all one line -- that linebreak was rudely inserted by Netscrape
--
I'm and work and must use Windows.)

Note the use of the temporary file 'foo'.

If you don't see how that command works, I recommend you read up on
bash
-- it's a nice shell, and those for loops at the command line are a
blast! If you really want to get high, start nesting them! :-D


Reply to: