How can I remove a directory of many files quicker? [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-2
down vote

favorite













This question already has an answer here:



  • What's the fastest way to remove all files & subfolders in a directory? [duplicate]

    4 answers



How can I remove a directory of many files fast?



For example, I backup my hard drive on an external drive, and when I need to release the space occupied by some very old backup on the external drive, I want to release the space as soon as possible.
rm -r /very/old/backup takes very long to finish running.



Thanks.







share|improve this question












marked as duplicate by αғsнιη, G-Man, Stephen Rauch, muru, taliezin Nov 6 '17 at 7:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Is there a solution faster than rm -r /very/old/backup in the link you gave? Or am I missing something?
    – Tim
    Nov 6 '17 at 4:48






  • 1




    Yeah, rsync there is super faster.
    – Î±Ò“sнιη
    Nov 6 '17 at 4:50










  • rsync was the slowest of the three, rm being fastest and find second.
    – Jasen
    Nov 6 '17 at 9:24










  • the best answer may be to change the way you do backups, rsync has some really useful features that can save both space and time.
    – Jasen
    Nov 6 '17 at 9:26














up vote
-2
down vote

favorite













This question already has an answer here:



  • What's the fastest way to remove all files & subfolders in a directory? [duplicate]

    4 answers



How can I remove a directory of many files fast?



For example, I backup my hard drive on an external drive, and when I need to release the space occupied by some very old backup on the external drive, I want to release the space as soon as possible.
rm -r /very/old/backup takes very long to finish running.



Thanks.







share|improve this question












marked as duplicate by αғsнιη, G-Man, Stephen Rauch, muru, taliezin Nov 6 '17 at 7:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Is there a solution faster than rm -r /very/old/backup in the link you gave? Or am I missing something?
    – Tim
    Nov 6 '17 at 4:48






  • 1




    Yeah, rsync there is super faster.
    – Î±Ò“sнιη
    Nov 6 '17 at 4:50










  • rsync was the slowest of the three, rm being fastest and find second.
    – Jasen
    Nov 6 '17 at 9:24










  • the best answer may be to change the way you do backups, rsync has some really useful features that can save both space and time.
    – Jasen
    Nov 6 '17 at 9:26












up vote
-2
down vote

favorite









up vote
-2
down vote

favorite












This question already has an answer here:



  • What's the fastest way to remove all files & subfolders in a directory? [duplicate]

    4 answers



How can I remove a directory of many files fast?



For example, I backup my hard drive on an external drive, and when I need to release the space occupied by some very old backup on the external drive, I want to release the space as soon as possible.
rm -r /very/old/backup takes very long to finish running.



Thanks.







share|improve this question













This question already has an answer here:



  • What's the fastest way to remove all files & subfolders in a directory? [duplicate]

    4 answers



How can I remove a directory of many files fast?



For example, I backup my hard drive on an external drive, and when I need to release the space occupied by some very old backup on the external drive, I want to release the space as soon as possible.
rm -r /very/old/backup takes very long to finish running.



Thanks.





This question already has an answer here:



  • What's the fastest way to remove all files & subfolders in a directory? [duplicate]

    4 answers









share|improve this question











share|improve this question




share|improve this question










asked Nov 6 '17 at 4:33









Tim

22.9k66225407




22.9k66225407




marked as duplicate by αғsнιη, G-Man, Stephen Rauch, muru, taliezin Nov 6 '17 at 7:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by αғsнιη, G-Man, Stephen Rauch, muru, taliezin Nov 6 '17 at 7:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • Is there a solution faster than rm -r /very/old/backup in the link you gave? Or am I missing something?
    – Tim
    Nov 6 '17 at 4:48






  • 1




    Yeah, rsync there is super faster.
    – Î±Ò“sнιη
    Nov 6 '17 at 4:50










  • rsync was the slowest of the three, rm being fastest and find second.
    – Jasen
    Nov 6 '17 at 9:24










  • the best answer may be to change the way you do backups, rsync has some really useful features that can save both space and time.
    – Jasen
    Nov 6 '17 at 9:26
















  • Is there a solution faster than rm -r /very/old/backup in the link you gave? Or am I missing something?
    – Tim
    Nov 6 '17 at 4:48






  • 1




    Yeah, rsync there is super faster.
    – Î±Ò“sнιη
    Nov 6 '17 at 4:50










  • rsync was the slowest of the three, rm being fastest and find second.
    – Jasen
    Nov 6 '17 at 9:24










  • the best answer may be to change the way you do backups, rsync has some really useful features that can save both space and time.
    – Jasen
    Nov 6 '17 at 9:26















Is there a solution faster than rm -r /very/old/backup in the link you gave? Or am I missing something?
– Tim
Nov 6 '17 at 4:48




Is there a solution faster than rm -r /very/old/backup in the link you gave? Or am I missing something?
– Tim
Nov 6 '17 at 4:48




1




1




Yeah, rsync there is super faster.
– Î±Ò“sнιη
Nov 6 '17 at 4:50




Yeah, rsync there is super faster.
– Î±Ò“sнιη
Nov 6 '17 at 4:50












rsync was the slowest of the three, rm being fastest and find second.
– Jasen
Nov 6 '17 at 9:24




rsync was the slowest of the three, rm being fastest and find second.
– Jasen
Nov 6 '17 at 9:24












the best answer may be to change the way you do backups, rsync has some really useful features that can save both space and time.
– Jasen
Nov 6 '17 at 9:26




the best answer may be to change the way you do backups, rsync has some really useful features that can save both space and time.
– Jasen
Nov 6 '17 at 9:26










1 Answer
1






active

oldest

votes

















up vote
1
down vote













Technically, this depends on the filesystem and the structure that's been set up for it. But in the normal case of UFS/EXT, the system has to visit each individual file to release space. In the case where you have many small files, it can take quite a while to walk the directory to release space.



Because your usage is as a backup, you might consider changing the layout before you need the space back. One option is to take the directory (potentially with many small files) and tar or zip it up. This will take some time, but can be done any time after the backup. When you have the archive file in place, delete the directory. At the end of the process, you have a single file on the filesystem, and can still pull any data you need from it.



When it's time to remove, you can rm a single file, which will go much more quickly.






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Technically, this depends on the filesystem and the structure that's been set up for it. But in the normal case of UFS/EXT, the system has to visit each individual file to release space. In the case where you have many small files, it can take quite a while to walk the directory to release space.



    Because your usage is as a backup, you might consider changing the layout before you need the space back. One option is to take the directory (potentially with many small files) and tar or zip it up. This will take some time, but can be done any time after the backup. When you have the archive file in place, delete the directory. At the end of the process, you have a single file on the filesystem, and can still pull any data you need from it.



    When it's time to remove, you can rm a single file, which will go much more quickly.






    share|improve this answer
























      up vote
      1
      down vote













      Technically, this depends on the filesystem and the structure that's been set up for it. But in the normal case of UFS/EXT, the system has to visit each individual file to release space. In the case where you have many small files, it can take quite a while to walk the directory to release space.



      Because your usage is as a backup, you might consider changing the layout before you need the space back. One option is to take the directory (potentially with many small files) and tar or zip it up. This will take some time, but can be done any time after the backup. When you have the archive file in place, delete the directory. At the end of the process, you have a single file on the filesystem, and can still pull any data you need from it.



      When it's time to remove, you can rm a single file, which will go much more quickly.






      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        Technically, this depends on the filesystem and the structure that's been set up for it. But in the normal case of UFS/EXT, the system has to visit each individual file to release space. In the case where you have many small files, it can take quite a while to walk the directory to release space.



        Because your usage is as a backup, you might consider changing the layout before you need the space back. One option is to take the directory (potentially with many small files) and tar or zip it up. This will take some time, but can be done any time after the backup. When you have the archive file in place, delete the directory. At the end of the process, you have a single file on the filesystem, and can still pull any data you need from it.



        When it's time to remove, you can rm a single file, which will go much more quickly.






        share|improve this answer












        Technically, this depends on the filesystem and the structure that's been set up for it. But in the normal case of UFS/EXT, the system has to visit each individual file to release space. In the case where you have many small files, it can take quite a while to walk the directory to release space.



        Because your usage is as a backup, you might consider changing the layout before you need the space back. One option is to take the directory (potentially with many small files) and tar or zip it up. This will take some time, but can be done any time after the backup. When you have the archive file in place, delete the directory. At the end of the process, you have a single file on the filesystem, and can still pull any data you need from it.



        When it's time to remove, you can rm a single file, which will go much more quickly.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 6 '17 at 4:47









        BowlOfRed

        2,335612




        2,335612












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay