In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to solve the problem of scp remotely copying directories or files containing spaces under linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Description:
Today, we need to copy some files remotely to the computer, ubuntu. The remote computer belongs to debian.
Files and directories contain a large number of spaces and are copied by scp, for example:
Scp-r root@192.168.0.51:/home/xxj/Documents/files/xx xx jj.tar.gz. /
At the very beginning, I realized that it was a space problem, so I used the file space to precede "\". It was impossible to live or die.
Scp-r root@192.168.0.51:/home/xxj/Documents/files/xx\ xx\ jj.tar.gz. /
Then we use quotation marks, single quotation marks and double quotation marks, but it still doesn't work.
Scp-r root@192.168.0.51:'/home/xxj/Documents/files/xx xx jj.tar.gz'. /
Scp-r root@192.168.0.51: "/ home/xxj/Documents/files/xx xx jj.tar.gz". /
Finally, put a slash in front of the space at the same time, and put quotation marks in the whole file directory.
Scp-r root@192.168.0.51: "/ home/xxj/Documents/files/xx\ xx\ jj.tar.gz". /
Batch cp and scp supplements with blank files under linux:
Background: the master and slave failed to synchronize the files. Now it is necessary to manually complete the files on the standby, but it is found that there is a space in the file name.
Host IP:192.168.0.90 host file manifest name: src_file.txt, standby file manifest name: dst_file.txt
As you can see from the following, the file path of the master and slave is different from the name of the file. During synchronization, you need to correspond one by one from src_file.txt copy to dst_file.txt, and the directories on the alternate machine are not guaranteed to exist, so you need to create the directory structure on the standby first.
[root@station90 file] # cat src_file.txt
/ home/src/10329/g0197/k/19xiazai h364.3gp
/ home/src/10327/g0194/10ng h364 xiazai.3gp
/ home/src/10329/g0196/lh/10xiazai h363.3gp
/ home/src/101117/060/090/1011.3gp
/ home/src/10520/056/0590/99833/10x_04 0_0_3.3gp
[root@station90 file] # cat dst_file.txt
/ home/dst/1038/g07/k/3/10290upload h364.3gp
/ home/dst/10327/g04/10ng h364 upload.3gp
/ home/dst/1038/g06/lhppww/10upload h363.3gp
/ home/dst/101117/06g090/1011.3gp
/ home/dst/1052g056/0590/33/10x_04 0_0_3.3gp
From dst_file.txt (standby file), we can know that the level of directory is not the same, that is to say, the first behavior is 6-level directory, but the second line is 4-level directory, how to take out the directory structure and create the directory structure first? Execute the following command:
[root@station90 file] # awk-F'/'{for
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.