rm -r only files?

2

1

Is there an way to remove all the files from the current dir (recursively), keeping the directory structure?

Dmitry Isaev

Posted 2013-03-11T11:48:54.483

Reputation: 176

Answers

7

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

Try without rm first to see what it will remove:

find . -type f

Kride

Posted 2013-03-11T11:48:54.483

Reputation: 1 079

Beat me by about 2 seconds :) – FreudianSlip – 2013-03-11T12:02:21.847

1Alternatife for find: --delete (That way it does not need to start rm for each file, so you get less overhead). – Hennes – 2013-03-11T13:55:21.860