Friday, November 4, 2016

Delete all files except one

For files:

find . ! -name 'file.txt' -type f -exec rm -f {} +

For directories:

find . ! -name 'directory' -type d -exec rm -rf {} +

0 comments:

Post a Comment

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Search This Blog

Powered by Blogger.