Home > OS >  Find deleted inefficient small file, have a better way?
Find deleted inefficient small file, have a better way?

Time:09-27

Ask a question, I use the find in the system/query/TMP -type f - min + 1 - exec rm - rf {} \;
Used to delete files found this script takes up resources much more special, the CPU can take up to 20-30%, but the system constantly, there came up trading and leads to a decline in performance, the system is primarily a small file in/query/TMP, to ask do you have any good idea can be more efficient, more rapidly deleted? In addition, what is the principle of the find job

CodePudding user response:

Why not use script to delete the script? So simple

CodePudding user response:

Is written in the script, the command is the command above

CodePudding user response:

This is a single concurrent to delete each one, will naturally slow down, can change the concurrent xrags way to delete
The find/query/TMP -type f - min + 1 | xargs -i rm - rf {}
Of course can also use a for loop to handle
A single concurrent example:
For I ` in the find/query/TMP -type f - min + 1 `; Do the rm - rf $I; The done
Multiple concurrent example:
For I ` in the find/query/TMP -type f - min + 1 `; Do the rm - rf $I & amp; The done
  • Related