[GRASSLIST:2520] Re: directory cleaning help

Roderick A. Anderson raanders at tincan.org
Fri Sep 28 11:36:26 EDT 2001


On Fri, 28 Sep 2001, Kevin Slover wrote:

> just a quick question, this might be more related to Linux
> question...but
> is there a way to clean raster files without going to each individual
> directory (ie cell, fcell, etc...)??  It is a pain to have to go to each
> directory and rm the files...

Kevin,

YMMV but if you know the extension or some common part of the name you
can use the find command and an execute parameter to do other stuff on
the files found.

EXAMPLE:

I want to delete all the tmp files in the user guest's directory and
subdirectories.

The command I would use is

	find /home/guest -name '*.tmp' -exec rm -f {} \;

   or

	find /home/guest -iname '*.tmp' -exec rm -f {} \;

if they might have mixed-case extensions.

Check the man page for more of an explanation and DO note the
curly braces are translated to the full pathname/filename and that the
back slash is require before the semi-colon.

ALSO ... the '-f' is a force on the remove command.  If you get the
wrong wildcard/filename you may do things you don't want done.  8-|


Cheers,
Rod
-- 
                      Let Accuracy Triumph Over Victory

                                                       Zetetic Institute
                                                        "David's Sling"
                                                         Marc Stiegler



More information about the grass-user mailing list