On Wed, Aug 11, 2004 at 08:49:23AM +0300, [EMAIL PROTECTED] wrote:
> Looks like you covered it well, except for white space in files.
> 
> Just one more thing to consider is that file names might
> be in non-ascii character set(?).
> So use "tr [:upper:] [:lower:]" to cover this option.
> 
> You can probably get the same effect as the use of "tac"
> with find's "-depth" switch.
> 
> I'd put your script in a file and run it with
> "find ... -print0 | xargs -0 your-move-script"

couldn't you do find ... -print0 -exec mv "{}" "$(changecase "{}")" \;

> that way you cover for white space in file names and such.
> (or, if I read sh(1) right then you can read output of
> "-print0" with "read -d\\0")
> 
> Cheers,
> 
> --Amos
> 
> Simon Bowden wrote:
> >On Wed, 11 Aug 2004, Simon Bowden wrote:
> >
> >>Possibly only lowercase relative links:
> >>if [ -L "$file" -a "${file:0:1}" != "/" ]; then
> >> ...
> >
> >
> >Oops, I'm going to be pedantic. This should be:
> >mv "$file" "$newname"
> >if [ -L "$file" ]; then
> >    target=$(ls -l "$file" | sed 's/^.* -> //'
> >    if [ "${target:0:1}" != "/" ]; then
> >        newtarget=$(echo "$target" | tr A-Z a-z)
> >        ln -sf "$newtarget" "$newname"
> >    fi
> >fi
> >
> >Since $file is the symlink name, not the target name.
> >
> >Extra pedant - I also realised we should use a raw read:
> >find ... | while read -r file ; do ...
> >
> >since then the filenames with backslash escapes in them (which probably
> >wouldn't be there, but still...).
> >
> >Errr, k, nuff now :) Fun with shell.
> >
> >Cheers,
> >
> > - Simon
> 
> -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
> 

Attachment: signature.asc
Description: Digital signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to