On Sat, 12 Feb 2000, A Page in the Life of ... wrote:

> -=> I've got two related but separate things I need to do.
> -=> 1) Recursivly assend into a directory and remove files that are under a certain
> -=> size (lets just say 5k)
> -=> 2) Recursivly assend into a directory and move all the files of a certain
> -=> pattern (*.html) to one directory 
> 
> man find
> 
> for the first try:
> 
> find /foo -size 5k -print
> 
> if it lists the files you want try:
> 
> find /foo -size 5k -exec rm {}\;
> 
> for the second it is: 
> find /foo -name \*.html -exec rm {}\;

Usin the "exec" functionality of the find command is often not very
efficient. Instead, it is common to use the "xargs" command in a pipe
instead. For example:

        find /foo -size 5k -print | xargs rm

The second example provided doesn't really do what was requested. I would
suggest that instead of using the rm command that you do somethin like
this:

        find /foo -name \*.html -print | while read file ; do \
        mv $file /other/directory ; done

- Marc


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to