In our daily work, we often come into contact with files without spaces. This makes the deletion operation much simpler. But sometimes we come across files with spaces in them. How should we delete this kind of file? First, let's demonstrate how to use the find command combined with the xargs command to delete files without spaces. [root@ELK-chaofeng test]# touch 1.txt 2.txt [root@ELK-chaofeng test]# ls 1.txt 2.txt [root@ELK-chaofeng test]# find . -type f | xargs ./1.txt ./2.txt [root@ELK-chaofeng test]# find . -type f | xargs rm -rf [root@ELK-chaofeng test]# ls [root@ELK-chaofeng test]# Next we demonstrate deleting files with spaces [root@ELK-chaofeng test]# touch 1.txt 2.txt '1 2.txt' [root@ELK-chaofeng test]# ls 1 2.txt 1.txt 2.txt [root@ELK-chaofeng test]# ll total 0 -rw-r--r-- 1 root root 0 Feb 14 12:24 1 2.txt -rw-r--r-- 1 root root 0 Feb 14 12:24 1.txt -rw-r--r-- 1 root root 0 Feb 14 12:24 2.txt [root@ELK-chaofeng test]# find . -type f -print0 | xargs -0 rm -rf [root@ELK-chaofeng test]# ls The above parameter -print0, compared with the default -print, outputs sequences separated by null characters instead of spaces. xargs also has a parameter -0, which can accept input streams separated by null instead of spaces. 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:
|
<<: Monitor changes in MySQL table content and enable MySQL binlog
>>: Why is it not recommended to use index as key in react?
Table of contents 1. Constraint concepts and clas...
SSH stands for Secure Shell, which is a secure tr...
This article mainly describes how to implement fo...
This article shares the specific code of Vue to i...
Make an animation of the eight planets in the sol...
Record the installation and configuration method ...
Back in the Kernel 2.6 era, a new security system...
I have always used Loadrunner to do performance t...
This article shares with you how to implement dra...
Vertical Split Vertical splitting refers to the s...
The <canvas> element is designed for client...
This article shares the specific code for using j...
Table of contents 1. What is event delegation? 2....
react.js framework Redux https://github.com/react...
Introduction to MQTT MQTT (Message Queuing Teleme...