Find the answer to your Linux question:
Results 1 to 3 of 3
I've stupidly set up an rsync backup of a sessions directory and there's probably around 50 million files in there now (at a rough guess). I've tried to delete the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    1

    How can I delete 50 million small files?


    I've stupidly set up an rsync backup of a sessions directory and there's probably around 50 million files in there now (at a rough guess).

    I've tried to delete the directory but with no success.

    The command I've been using is:

    find . -type f -exec rm -v {} \;

    What else can I try?

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,414
    To delete a directory you need to use the command "rmdir", or add a "-r" flag to the rm command.

    Welcome to the forums by the way!
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by Dmag View Post
    I've stupidly set up an rsync backup of a sessions directory and there's probably around 50 million files in there now (at a rough guess).

    I've tried to delete the directory but with no success.

    The command I've been using is:

    find . -type f -exec rm -v {} \;

    What else can I try?
    In which sense doesn't it work? It should (only for files, not dirs, as specified by -type f).

    The only thing you are missing is proper quoting around the brackets '{}', which you should always use unless you are 100% sure that no file in there holds special characters on its name.

    That, provided that you have write permissions over those files, of course.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •