From owner-freebsd-questions@FreeBSD.ORG Sat Aug 9 05:10:37 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7511937B404 for ; Sat, 9 Aug 2003 05:10:37 -0700 (PDT) Received: from mail.sacbee.com (filter.sacbee.com [206.107.198.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF1C543F75 for ; Sat, 9 Aug 2003 05:10:36 -0700 (PDT) (envelope-from scoile@nandomedia.com) Received: by EXCHANGEMCC with Internet Mail Service (5.5.2653.19) id ; Sat, 9 Aug 2003 05:11:21 -0700 Received: from snake-eyes (nandopixeast.nandomedia.com [152.52.40.13]) by exchangemcc.mcclatchy.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id P88YV3XB; Sat, 9 Aug 2003 05:11:19 -0700 From: Steve Coile To: Vincent Zee Date: Sat, 9 Aug 2003 08:08:10 -0400 (EDT) In-Reply-To: <20030809140446172121.GyazMail.basics@zenzee.cistron.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: FreeBSD Questions Subject: Re: converting %20 to a space in directory names X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Aug 2003 12:10:37 -0000 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