tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Those Damn Users' Caches Won't Go Away ...

Help, I want to do baaaad things :-) ▻

Those Damn Users' Caches Won't Go Away ...

In article <slrn8dmb1e.gr4.dcoughlan@ophelia.fdi.net>,
Desmond Coughlan <dcoughlan@vdp.fr> wrote:
>On 23 Mar 2000 17:25:29 -0000, Tim Goodwin <tjg@star.le.ac.uk> wrote:
>> Does it produce any errors at all?  You might be running into argument
>> length limits, but the shell would complain about that.

A lucky "guess" :-).

>rm: cannot remove `/export/home/chailley/USERS/DEFAULT/CACHE/*': No such file or directory

OK, that implies that there are no files at all in that user's cache
directory.  You can silence this error by using `rm -f'.

>./purge: /bin/rm: Argument list too long

And this means that some user has so many files that they exceed your
system's limit on command line arguments.  The most general solution
to this is to use xargs(1); in this case in combination with find(1).

    #! /bin/sh
    for LOCATION in `ls /export/home/` ; do
            find /export/home/$LOCATION/USERS/DEFAULT/CACHE -type f -print |xargs rm -f
    done

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Those Damn Users' Caches Won't Go Away ...
Date: 24 Mar 2000 09:41:25 -0000
Message-ID: <8bfd8r$m45$1@ltpcg.star.le.ac.uk>
References: <slrn8dhog5.era.dcoughlan@ophelia.fdi.net>
  <8bdk2v$kve$1@ltpcg.star.le.ac.uk>
  <slrn8dmb1e.gr4.dcoughlan@ophelia.fdi.net>

△ comp.unix.shell △

◅ Those Damn Users' Caches Won't Go Away ...

Help, I want to do baaaad things :-) ▻