Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How exclude files / folders for remove [duplicate]

How can I remove all in folder and exclude specific folders and files?

(As example with tar: tar --exclude="folder").

Edit: I can delete files and folders.

like image 800
grogsy Avatar asked Jun 19 '13 07:06

grogsy


1 Answers

NOTE: Be careful running the following commands.

find . -type 'f' | grep -v "NameToExclude" | xargs rm 
find . -type 'd' | grep -v "NameToExclude" | xargs rmdir
like image 73
rein Avatar answered Oct 19 '22 22:10

rein