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

Latest Images

Trending Articles



Latest Images