Smazání podadresářů

Zdenek Pytela letty na mrakoplas.phil.muni.cz
Úterý Leden 7 14:53:23 CET 2003


Pavel Trefný píše:
> On Tue, 7 Jan 2003, Novy David wrote:
> 
> > Ahoj, mam sambu a v ní cestovní profily. Potřeboval bych vždy po nějaké době
> > smazat ze všech profilu dočasné soubory internetu, ale nějak nemůžu přijít
> > na správnou syntaxi. Nevíte jak na to:
> > 
> > Zkoušel jsem toto, ale to smaže vše:
> > 
> > find /var/profiles/ -type d -name 'Content.IE5' -exec rm -r * \;
> 
> co treba ?
> 
> find /var/profiles/ -type d -name 'Content.IE5' -exec rm -rf * \;
	Tak to jste to fakt vylepšil, v další odpovědi bude určitě
"rm -rf /". Substituci za jméno souboru dělá {}, jak je ostatně napsáno
v manuálové stránce find (1):
...
   ACTIONS
       -exec command ;
              Execute command; true if 0 status is returned.  All
              following arguments to find are taken to  be  argu-
              ments  to  the command until an argument consisting
              of `;' is encountered.  The string `{}' is replaced
              by the current file name being processed everywhere
              it occurs in the arguments to the command, not just
              in arguments where it is alone, as in some versions
              of find.  Both of these constructions might need to
              be  escaped  (with a `\') or quoted to protect them
              from expansion by the shell.  The command  is  exe-
              cuted in the starting directory.

...

-- 

--Zdeněk Pytela, <letty na mrakoplas.phil.muni.cz>



Další informace o konferenci Linux