[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cancellare file ricorsivamente



Il dom, 2004-08-01 alle 20:01, Pierfrancesco Caci ha scritto:
> :-> "Massimo" == Massimo Arnaudo <home@massimo.arnaudo.name> writes:
> 
>     > Ciaoa tutti,
>     > vorrei cancellare i file che soddisfano un parametro (in questo caso i
>     > file html), im modo ricorsivo per tutte le subdirectory.
> 
>     > Ho provato con il seguente comando, ma inutilmente:
> 
>     > rm -R ./*.html
> 
>     > Qualche consiglio?
> 
> 
> find . -name "*.html" -exec rm {} \;
> 
> man find se vuoi sapere perche`...

path pattern
              File  name  matches  shell pattern pattern.  The
metacharacters do not treat `/' or `.' specially; so, for
              example,
                        find . -path './sr*sc'
              will print an entry for a directory called './src/misc'
(if one exists).   To  ignore  a  whole  directory
              tree,  use  -prune  rather  than  checking  every  file 
in  the tree.  For example, to skip the directory
              `src/emacs' and all files and directories under it, and
print the names of the other files found, do some-
              thing like this:
                        find . -path './src/emacs' -prune -o -print

-exec command ;
              Execute command; true if 0 status is returned.  All
following arguments to find are taken to be  arguments
              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  argu-
              ments  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  executed  in
              the starting directory.


Ciao e grazie ancora.

Massimo
-- 
E impari che puoi davvero sopportare,
che sei davvero forte,
e che vali davvero.
---		---
HomePage:	http://www.massimo.arnaudo.name
LinuxGroup:	http://www.lugge.net



Reply to: