Quantcast
Channel: Remove all files except some from a directory - Stack Overflow
Viewing all articles
Browse latest Browse all 21

Answer by Daniel Chen for Remove all files except some from a directory

$
0
0

This is similar to the comment from @siwei-shen but you need the -o flag to do multiple patterns. The -o flag stands for 'or'

find . -type f -not -name '*ignore1' -o -not -name '*ignore2' | xargs rm


Viewing all articles
Browse latest Browse all 21

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>