[Samba] file names convert
Michael Wood
esiotrot at gmail.com
Sat Sep 18 16:28:28 MDT 2010
On 17 September 2010 18:48, Lennart Sorensen
<lsorense at csclub.uwaterloo.ca> wrote:
> On Fri, Sep 17, 2010 at 10:24:29AM +0200, Michael Wood wrote:
>> No, it does not:
>>
>> $ touch "File With Spaces.txt"
>> $ touch "Other File Also With Spaces.txt"
>> $ touch lowercase.txt
>> $ touch duplicate.txt
>> $ touch DUPLICATE.txt
>> $ for f in *; do lower="`echo $f | tr [:upper:] [:lower:]`"; if [ "$f"
>> != "$lower" ]; then mv -i "$f" "$lower"; fi; done
>> mv: overwrite `duplicate.txt'? n
>> $ ls -l
>> total 0
>> -rw-r--r-- 1 michael michael 0 2010-09-17 10:19 duplicate.txt
>> -rw-r--r-- 1 michael michael 0 2010-09-17 10:19 DUPLICATE.txt
>> -rw-r--r-- 1 michael michael 0 2010-09-17 10:18 file with spaces.txt
>> -rw-r--r-- 1 michael michael 0 2010-09-17 10:19 lowercase.txt
>> -rw-r--r-- 1 michael michael 0 2010-09-17 10:19 other file also with spaces.txt
>
> Oh I see, I missed that it did actually have quotes for the mv. Yeah the
> echo doesn't matter.
>
> I do wonder if it would work if you had two spaces in a row. I suspect
> it would compact multispace to one space. Probably would convert tabs
> to spaces too. Probably not a common case, but hey gotta make sure it
> is perfect.
hmmm... You got me there.
[...]
>> > How about "rename 's/(.*)/\L$1\E/' filenames" ?
>>
>> Ah, I wasn't aware of that. Thanks.
>
> It's a handy tool that comes with perl I believe. So the regex is
> perl regex.
Yes, I noticed :)
--
Michael Wood <esiotrot at gmail.com>
More information about the samba
mailing list