Mac OS X 上的 scp 问题:scp 不喜欢文件名中的空格,“\”修复不起作用

发布于 2024-11-24 06:53:37 字数 662 浏览 2 评论 0原文

我正在尝试使用 scp 在两台 Mac(操作系统 10.6.8)之间传输文件。但它失败了,因为我的目录/文件名中有空格。我无法更改目录/文件名。

当我使用 Mac 在终端中工作时,我经常使用 \ 符号来表示空格。然而,在这种情况下,它不起作用。我非常感谢有关如何处理此问题的任何提示。谢谢。

这是我正在做的一个例子,以防我在某个地方犯了一个愚蠢的错误:

scp -r me@myWork:../../My\ documents/Projects/Project\ 1/* ./Desktop

Error: scp: ../../My: No such file or directory

我也尝试了 rsync,但这也不起作用:

rsync -avub -e ssh me@myWork::../../My\ documents/Projects/Project\ 1/* ./Desktop

rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-40/rsync/io.c(452)

I am trying to use scp to transfer files between two Macs (OS 10.6.8). But it fails because there are spaces in my directory/file names. I can't change the directory/file names.

I have often used a \ symbol when working in a terminal with my Macs to represent spaces. In this case, however, it is not working. I would very much appreciate any tips on how to deal with this. Thanks.

Here is an example of what I'm doing, in case I'm making a silly mistake somewhere:

scp -r me@myWork:../../My\ documents/Projects/Project\ 1/* ./Desktop

Error: scp: ../../My: No such file or directory

I tried rsync too and that doesn't work either:

rsync -avub -e ssh me@myWork::../../My\ documents/Projects/Project\ 1/* ./Desktop

rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-40/rsync/io.c(452)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雨巷深深 2024-12-01 06:53:37

对我来说,我实际上需要同时做这两件事:

scp -r 127.0.0.1:/Volumes/Folders/Faces/"Why\ Spaces\ Why"/"Insanity\ Rules"/ .

for me I needed to actually do both:

scp -r 127.0.0.1:/Volumes/Folders/Faces/"Why\ Spaces\ Why"/"Insanity\ Rules"/ .
↘紸啶 2024-12-01 06:53:37

这适用于 10.14.5 Mojave10.15.7 Catalina

scp -r [email protected]:~/Library/MobileDevice/"Provisioning\ Profiles"/. ~/Library/MobileDevice/"Provisioning Profiles"/.

注意:

源路径具有 “Provisioning\ Profiles”

目标路径具有 “配置配置文件”

This worked for 10.14.5 Mojave and 10.15.7 Catalina

scp -r [email protected]:~/Library/MobileDevice/"Provisioning\ Profiles"/. ~/Library/MobileDevice/"Provisioning Profiles"/.

Note:

the source path has "Provisioning\ Profiles"

the destination path has "Provisioning Profiles"

甜扑 2024-12-01 06:53:37

你没有逃出“我的”后面的空格。这:

me@myWork:../../My documents/Projects/Project\ 1/*

应该是:

me@myWork:../../My\ documents/Projects/Project\ 1/*

或者您可以将整个路径用引号引起来。

You didn't escape the space after "my". This:

me@myWork:../../My documents/Projects/Project\ 1/*

should be:

me@myWork:../../My\ documents/Projects/Project\ 1/*

Or you could just wrap the entire path in quotes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文