How To Remove All Files In A Folder Except One Specific File In Linux

Remove All Files In A Folder Except One Specific File In Linux

1 Response

  1. Rogerio Pereira da Silva says:

    ls | egrep -v ‘.(doc|mp3|pdf)$’ | xargs -iXX rm -fv XX

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.