Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Nov 2011 18:08:44 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Rodrigo Gonzalez <rjgonzale@estrads.com.ar>
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>, Graeme Dargie <arab@tangerine-army.co.uk>
Subject:   Re: removing directories
Message-ID:  <4EB42A2C.2030704@infracaninophile.co.uk>
In-Reply-To: <4EB423CD.6040702@estrads.com.ar>
References:  <0EE458C34045A44DBC2CA2DC5CEB42B5239647FE05@mercury.universe.galaxy.lcl> <4EB423CD.6040702@estrads.com.ar>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigA964D57777CBEE52CA92D859
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 04/11/2011 17:41, Rodrigo Gonzalez wrote:
> El 04/11/11 13:25, Graeme Dargie escribi=F3:
>> 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?
>>
>> Regards
>>
>> G
>>
> I dont know how to make in one command....but to delete thumbnails
> directories
>=20
> find . -type d -name thumbnails -exec rm -rf {} \;
>=20
> You can do the same for the pages directories
>=20
> To test what you will delete please run
>=20
> find . -type d -name thumbnails -print
>=20
> and see that it is correct

In one command:

find . -depth 3 -type d \( -name pages -o -name thumbnails \) \
   -exec rm -rf '{}' +

The '-depth 3' bit avoids deleting any pages or thumbnails directories
higher up the tree, assuming that any such exist.  Leave it out if that
isn't a concern.

Use -print as Rodrigo suggests to avoid foot-shooting scenarios...

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew@infracaninophile.co.uk               Kent, CT11 9PW


--------------enigA964D57777CBEE52CA92D859
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk60KjUACgkQ8Mjk52CukIxz9wCfUpxzF9QWnnW02TilxTXB5nF6
IPsAoIMrnxtD/rDzklGQrYs+N05BQGHq
=svcx
-----END PGP SIGNATURE-----

--------------enigA964D57777CBEE52CA92D859--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EB42A2C.2030704>