On Sat, 9 Aug 2003, Vincent Zee wrote:
>I have 5000 directory names with %20 in its names and would like to
>replace them with 1 space.
>I only want to change the directory names and leave its contents
>untouched. Also I need to do this recursively (directories in
>directories).
>I checked google but the answers I found were for files in directories.

Completely untested.  Use at your own risk.

Replace "TOPDIR" with the name of the top of the directory tree.

        find TOPDIR -depth -type d -name '*%20*' -print \
        | while read old
        do
                new="`echo \"${old}\" | sed -e 's/%20/ /g'`"
                ( set -x; mv "${old}" "${new}" )
        done

-- 
Steve Coile
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to