How to Delete all files except a Pattern in Unix
Good Morning To All My TECH Ghettos,
Today ima show ya’ll a fuckin command to delete all files except a pattern,
ya’ll can use it in a script or even commandline ……. Life gets easy as Fuck !!!!!!!!
find . -type f ! -name ‘<pattern>’ -delete
A Live Example
Before
After the following Command
find . -type f ! -name ‘*.gz’ -delete
You must be logged in to post a comment.