In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to move multiple file types from the command line in linux at the same time, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Move multiple file types at the same time
Imagine this scenario where you have multiple types of files in a directory called dir1, such as .pdf, .doc, .mp3, .mp4, .txt, and so on. Let's take a look at dir1's content:
$ls dir1file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4
You want to move some file types (not all file types) to another location. For example, suppose you want to move .doc, .pdf, and .txt files to another directory called dir2 at once.
To move .doc, .pdf, and .txt files from dir1 to dir2 at the same time, the command is:
$mv dir1/*. {doc,pdf,txt} dir2/
It's easy, isn't it?
Now let's take a look at the contents of dir2:
$ls dir2/file.txt mydoc.doc personal.pdf
You see that? Only .doc, .pdf, and .txt moved from dir1 to dir2.
In the above command, you can add any number of file types within the curly braces to move them to different directories. It suits me very well on Bash.
Another way to move multiple file types is to go to the source directory, which in our case is dir1:
$cd ~ / dir1
Move the file type of your choice to the destination (that is, dir2), as follows:
$mv * .doc * .txt * .pdf / home/sk/dir2/
To move all files with a specific extension, such as .doc, run:
$mv dir1/*.doc dir2/
For more details, refer to the man page:
$man mv
It's easy to move some same or different file types! You can do this with a few mouse clicks in GUI mode or with one line of command in CLI mode. However, if there are thousands of different file types in the directory, and you want to move multiple file types to different directories at once, this can be a tedious task. For me, the above method is easy to finish the work! If you know that any other one-line command can move multiple file types at a time, please share it with us in the comments section below. I will check and update the guide.
Thank you for reading this article carefully. I hope the article "how to move multiple file types from the command line at the same time in linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.