Domanda

I was wondering how we can use linux rm command with --exclude switch?

For example like grep has exclude function when searching over the files.

È stato utile?

Soluzione

Here is one specific

rm `find . -name "safe_room*" ! -name "safe_rooms.php"`

I used it mainly for git

git rm `find . -name "safe_room*" ! -name "safe_rooms.php"`

Explanation:

rm - linux command for delete

`` - the signs used within mysql. on keyboard CTRL + 7

find . -name "safe_room*" - find everything with safe_room*

! - NOT logical operator

-name "safe_rooms.php" - exclude everything except safe_rooms.php

Hope this will help :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top