Linux rm deletes a large number of files, linuxrm
When you use rm to delete a large number of files, you may encounter an Argument list too long problem. As shown below
[oracle@DB-Server bdump]$ rm -v epps_q001_*
-bash: /bin/rm: Argument list too long
Check the total number of such files, as shown below. There are 8348 files in total.
[oracle@DB-Server bdump]$ ls -lrt epps_q001_* | wc -l
-bash: /bin/ls: Argument list too long
0
[oracle@DB-Server bdump]$ find . -name "epps_q001_*" | wc -l
8438
The xargs command can be used to solve this problem. As follows:
[oracle@DB-Server bdump]$ find . -name "epps_q001_*" | xargs rm -r
An error occurred while deleting a large number of files in linux.
Two methods:
1) find
Find.-name *-exec rm {}\;
2) Pipelines
Ls-l | awk '{print $9}' | rm
If you want to delete a directory, use the r parameter in the rm command. If you do not need a prompt when deleting the directory, add the f parameter. Use the r and f parameters of rm with caution!
In Linux, how does one completely delete the rm file?
Rm-r + file path;
For example, to delete the 1.txt file in the/home/ftk/apache-tomcat-5.5.20/workrm folder, run the following command:-r/home/ftk/apache-tomcat-5.5.20/work/1.txt.
Hope to help you, hope to adopt it ~