Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Aug 2003 08:08:10 -0400 (EDT)
From:      Steve Coile <scoile@nandomedia.com>
To:        Vincent Zee <basics@zenzee.cistron.nl>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: converting %20 to a space in directory names
Message-ID:  <Pine.LNX.4.33.0308090804250.28523-100000@snake-eyes.nandomedia.com>
In-Reply-To: <20030809140446172121.GyazMail.basics@zenzee.cistron.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0308090804250.28523-100000>