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

Answer by wyx for Remove all files except some from a directory

$
0
0

Just:

rm $(ls -I "*.txt" ) #Deletes file type except *.txt

Or:

rm $(ls -I "*.txt" -I "*.pdf" ) #Deletes file types except *.txt & *.pdf

Viewing all articles
Browse latest Browse all 21

Trending Articles