From owner-freebsd-questions@FreeBSD.ORG Fri Nov 4 18:03:38 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78B76106566C for ; Fri, 4 Nov 2011 18:03:38 +0000 (UTC) (envelope-from lars@larseighner.com) Received: from mail.team1internet.com (mail.team1internet.com [216.110.13.10]) by mx1.freebsd.org (Postfix) with ESMTP id 599D18FC0C for ; Fri, 4 Nov 2011 18:03:38 +0000 (UTC) Received: from larseighner.com (unknown [216.110.13.91]) by mail.team1internet.com (Postfix) with SMTP id EC33B16B4C7; Fri, 4 Nov 2011 13:03:35 -0500 (CDT) Received: by larseighner.com (nbSMTP-1.00) for uid 1001 lars@larseighner.com; Fri, 4 Nov 2011 13:03:35 -0500 (CDT) Date: Fri, 4 Nov 2011 13:03:33 -0500 (CDT) From: Lars Eighner X-X-Sender: lars@noos.6dollardialup.com To: Graeme Dargie In-Reply-To: <0EE458C34045A44DBC2CA2DC5CEB42B5239647FE05@mercury.universe.galaxy.lcl> Message-ID: References: <0EE458C34045A44DBC2CA2DC5CEB42B5239647FE05@mercury.universe.galaxy.lcl> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "freebsd-questions@freebsd.org" Subject: Re: removing directories X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2011 18:03:38 -0000 On Fri, 4 Nov 2011, Graeme Dargie wrote: > Ok this might be a bit of a newbie question but here goes. > > I have a large number of directories around 300 which all have sub dirs, > some of those have sub dirs in each of these there are two further sub > dirs called pages and thumbnails, is there an easy way to remove all the > pages and thumbnail dirs from the tree? the easiest way to remove one directory and all of its contents including subdirectories and their contents is rm -r dirname if you put the trailing slash in rm -r dirname/ you will remove the contents but not the directory itself. To remove 300 will still be a considerable task if you cannot find a way to get at the only ones you want to remove. See man [ for ideas on how to test for the existence of pages/ and thumbnail/ subdirectories. This could be the basis of a shell script for identifying and removing the directories you want to target. If there is relatively litte stuff in the parent directory that you want to save, it may be easier to remove the stuff you want to save to a safe place, remove the contents of the parent directory, and move the saved stuff back. Backing up everything before you start is a really good idea even if you are a shell script wizard. > > Regards > > G > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > > > -- Lars Eighner http://www.larseighner.com/index.html 8800 N IH35 APT 1191 AUSTIN TX 78753-5266