In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How does linux empty the files in a directory? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
Linux: 1. Use the "rm-f *" command to delete all files in the current directory. 2. Use the find command to find and delete ordinary files. 3. Delete all ordinary files through the "rm-f `find.-type f`" command. 4. Delete files with for loop statement.
10 methods of deleting files in directory by Linux
After reading the article, I suddenly remembered the method of deleting all the files in the directory in Linux, and sorted out a few, if there are any deficiencies, I hope readers will not hesitate to comment!
Delete files in the current directory
1.rm-f *
# the classic method is to delete all types of files in the current directory
2.find. -type f-delete or find. -type f-exec rm-f {}\
# find a normal file and delete it with the find command and delete it with the processing action of the find command or
3.find. -type f | xargs rm-f
# too long parameter list; too many files to delete
4.rm-f `find. -type f`
# Delete all ordinary files
5.for delete in `ls-l`; do rm-f *; done
# use for loop statement to delete all types of files in the current directory
Delete files in the specified directory
1.rm-f specifies the directory *
# the most classic way to delete all types of files in the specified directory
2.find specified directory-type f-delete or find specified directory-type f-exec rm-f {}\
# use the find command to find all ordinary files in the specified directory and delete the or. Delete them with the processing action of the find command
3.find specifies the directory-type f | xargs rm-f
# too long parameter list; too many files to delete
4.rm-f `find specify directory-type f`
# Delete all ordinary files in the specified directory
5.for delete in `ls-l specifies the directory path`; do rm-f *; done
# use for loop statement to delete all types of files in the specified directory
Thank you for reading! After reading the above, do you have a general idea of linux's method of emptying files in a directory? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.