IPB

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> [RÉSOLU] shell : commande exec et exclure un répertoire
Options
clarusad
posté 3 Jul 2016, 14:27
Message #1


Macbidouilleur de bronze !
**

Groupe : Membres
Messages : 309
Inscrit : 17 Oct 2006
Lieu : Strasbourg, France
Membre no 70 694



Salut,
Je souhaiterais exécuter une commande à travers toute une arborescence, jusqu'ici pas de problèmes :
Code
find /Sites/toto/public_html -name .DS_Store -exec rm {} \;

mais je voudrais exclure un répertoire, par exemple :
/Sites/tata/public_html

Comment faire,
Merci

Ce message a été modifié par clarusad - 6 Jul 2016, 07:51.
Go to the top of the page
 
+Quote Post
Jaypee
posté 3 Jul 2016, 18:23
Message #2


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 486
Inscrit : 29 Aug 2002
Membre no 3 340



La question a été posée sur StackOverflow : http://stackoverflow.com/questions/1346048...tory-using-find

J-P
Go to the top of the page
 
+Quote Post
clarusad
posté 5 Jul 2016, 08:06
Message #3


Macbidouilleur de bronze !
**

Groupe : Membres
Messages : 309
Inscrit : 17 Oct 2006
Lieu : Strasbourg, France
Membre no 70 694



Merci pour le lien, je n'étais pas tombé dessus. Entre temps j'avais trouvé ça :
Code
find /Sites/toto/public_html ! -path "/Sites/tata/public_html/*" -name .DS_Store -exec rm {} \;

C'est pareil, non ?
Go to the top of the page
 
+Quote Post
Jaypee
posté 6 Jul 2016, 06:11
Message #4


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 486
Inscrit : 29 Aug 2002
Membre no 3 340



Dans le "man find", il y a cet exemple :

EXAMPLES
The following examples are shown as given to the shell:

find / \! -name "*.c" -print
Print out a list of all the files whose names do not end in .c.

Donc oui le caractère ! est équivalent à -not, et malgré la doc, la protection par \ n'est pas indispensable

J-P


Go to the top of the page
 
+Quote Post
clarusad
posté 6 Jul 2016, 07:48
Message #5


Macbidouilleur de bronze !
**

Groupe : Membres
Messages : 309
Inscrit : 17 Oct 2006
Lieu : Strasbourg, France
Membre no 70 694



Super, merci pour les infos !
Je passe le topic en résolu.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



Nous sommes le : 19th March 2024 - 08:46