Removing thousands of files using rm
Kirk Strauser
kirk at strauser.com
Tue Jul 6 13:00:41 PDT 2004
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
More information about the freebsd-questions
mailing list