[ale] delete all files but leave folder structure intact

Michael B. Trausch mike at trausch.us
Mon Apr 18 15:45:22 EDT 2011


On 04/18/2011 03:13 PM, Narahari 'n' Savitha wrote:
> How can I accomplish this in the linux world ?

At the top level directory:

  find . -type f -exec rm {} \;

Or, for ANY directory:

  find /path/to/dir -type f -exec rm {} \;

Or you could do it this way:

  find /path/to/dir -print0 | xargs -0 rm

As always, BE CAREFUL when doing something like that.  You don't want to
delete all of the files from the wrong directory tree!

	--- Mike


More information about the Ale mailing list