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?
Basic Concepts By default, Compose creates a netw...
XML/HTML CodeCopy content to clipboard <!DOCTY...
This article example shares the specific code of ...
Typically, we use the following SQL statement to ...
Preface The previous article installed Hadoop, an...
The application of containers is becoming more an...
1. Download Maven Maven official website: http://...
html <!DOCTYPE html> <html lang="en...
1. Overview The information_schema database is th...
This tutorial shares the installation and configu...
Table of contents 1. Security issues with Docker ...
React Native is a cross-platform mobile applicati...
Drop-shadow and box-shadow are both CSS propertie...
A Thorough Analysis of HTML (14) Special Characte...
MySql Download 1. Open the official website and f...