luvbeastie at larseighner.com
Fri Nov 4 18:03:38 UTC 2011
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.
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
8800 N IH35 APT 1191 AUSTIN TX 78753-5266
More information about the freebsd-questions