Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jul 2004 15:00:23 -0500
From:      Kirk Strauser <kirk@strauser.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Removing thousands of files using rm
Message-ID:  <200407061500.23299.kirk@strauser.com>
In-Reply-To: <3703.209.167.16.15.1089123354.squirrel@209.167.16.15>
References:  <3703.209.167.16.15.1089123354.squirrel@209.167.16.15>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 2004-07-06 09:15 am, Steve Bertrand wrote:

> The directory I am trying to remove the files from is always hot, so
> deleting the directory is unfortunately not an option. (I don't think).

If the directory is /var/tmp/foo, what about making "foo" a symlink to 
"foo.0", then do something like:

  # mkdir foo.1
  # ln -fsn foo.1 foo
  # rm -rf foo.0

I'm reasonably sure that the second line is an atomic operation, although I 
don't have the time to verify it just now.  I'm sure someone will correct 
me if I'm wrong.  :)

Anyway, /var/tmp/foo would always exist and point to a valid destination.  
You'd have your "hot" directory while being able to move the old version 
out of the way for deletion at your leisure.
-- 
Kirk Strauser



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407061500.23299.kirk>