Re: Removing thousands of files using rm

From: Kirk Strauser (kirk_at_strauser.com)
Date: 07/06/04

  • Next message: Lucas Holt: "Re: mod_mono"
    To: freebsd-questions@freebsd.org
    Date: Tue, 6 Jul 2004 15:00:23 -0500
    
    

    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
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
    

  • Next message: Lucas Holt: "Re: mod_mono"