Yesterday, we encountered a situation where we wanted to delete a large number of files in Linux. we needed to delete several 100,000 files. This is the log written by the previous program, which is growing fast and useless. At this time, the common Delete command rm-fr * is not easy to use, because it takes too long to wait. Therefore, we must take some extraordinary measures. We can use rsync to quickly delete a large number of files. 1. install rsync: yuminstallrsync2 first, create an empty folder: mkdir/tmp/test3, and use rsyn
Yesterday, we encountered a situation where we wanted to delete a large number of files in Linux. we needed to delete several 100,000 files. This is the log written by the previous program, which is growing fast and useless. At this time, the common Delete command rm-fr * is not easy to use, because it takes too long to wait. Therefore, we must take some extraordinary measures. We can use rsync to quickly delete a large number of files.
1. install rsync first:
Yum install rsync
2. create an empty folder:
Mkdir/tmp/test
3. use rsync to delete the target Directory:
Rsync -- delete-before-a-H-v -- progress -- stats/tmp/test log
In this way, the log directory to be deleted will be cleared and the deletion speed will be very fast.