Test the efficiency of deleting a large number of files under Linux. First create 500,000 files 1. rm delete
rm does not work due to the large number of files. 2. Find and delete
About 43 minutes on my computer. . . . . . I deleted it while watching the video. 3. find with delete
It takes 9 minutes. 4. rsync delete
Very good and powerful. 5. Python Delete import os import timeit def main(): for pathname,dirnames,filenames in os.walk('/home/username/test'): for filename in filenames: file = os.path.join(pathname,filename) os.remove(file) if __name__ == '__main__': t = timeit.Timer('main()','from __main__ import main') print t.timeit(1) 1 2 $ python test.py 529.309022903 It takes about 9 minutes. 6. Perl Delete
This should be the fastest. 7. Results:
Conclusion: rsync is the fastest and most convenient way to delete a large number of small files. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Understanding v-bind in vue
>>: Detailed explanation of the use of MySQL mysqldump
Introduction to vi/vim They are both multi-mode e...
Using Technology itext.jar: Convert byte file inp...
1. Hot deployment: It means redeploying the entir...
Preface The notification bar component is a relat...
Zabbix 2019/10/12 Chenxin refer to https://www.za...
Table of contents 1. The principle of index push-...
The implementation method is divided into three s...
Problem: The overflow of the auto-increment ID in...
01. Command Overview The paste command will merge...
Basic preparation For this implementation, we nee...
1. First, let’s have a general introduction to th...
ffmpeg is a very powerful audio and video process...
Code implementation: Copy code The code is as fol...
The command pattern is a behavioral design patter...
This article uses examples to describe the common...