如何在rsync中通过FTP复制所有文件
我有一些主机的在线帐户,它为我提供了带有用户名和密码的 FTP 帐户。
我有另一个公司,它给了我 FTP 和 rsync 。
现在我想使用 rync 将所有文件从旧 FTP 传输到新 FTP。
现在是否可以通过 rsync 来完成,因为我不想先在计算机上复制然后再次上传
I have online account with some Host which give me FTP account with username and password .
i have another with copany which gave me FTP and rsync .
Now i want to transfer all my files from old FTP to NEW FTP with rync.
Now is it possible to do it via rsync only because i don't want to first copy on computer and then upload again
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
让我们仅使用 FTP
src
来调用机器。让我们使用 FTP 和 SSH
dst
调用机器。请注意,在命令行上使用
--ftp-password
运行wget
会将密码泄露给系统上的其他任何人。 (以及以明文方式通过线路传输,但您知道这一点。)如果您无权访问
wget
,那么他们可能有ncftp
或 <已安装 code>lftp 或ftp
。我只是碰巧知道wget
最好。 :)编辑 要使用
ftp
,您需要执行类似以下操作:此时,记下远程系统上的所有目录。使用
!mkdir
创建每一个。然后更改为本地和远程目录:对所有目录重复此操作。使用
mget *
获取所有文件。如果这看起来很糟糕,那是因为事实确实如此。 FTP 不是为此而设计的,如果您的新主机没有更好的工具(请务必查找
ncftp
和lftp
以及类似ftpmirror 的东西
),然后要么自己编译更好的工具,要么擅长围绕不好的工具编写脚本。 :)或者,如果您可以在 src 上获得 shell,那也会有很大帮助。 FTP 并不适合传输数千个文件。
无论如何,这可以避免在本地系统中发生跳动,这应该会显着提高吞吐量。
Lets call the machine with only FTP
src
.Lets call the machine with FTP and SSH
dst
.Note that running
wget
with--ftp-password
on the command line will give away the password to anyone else on the system. (As well as transferring it over the wire in the clear, but you knew that.)If you don't have access to
wget
, then they might havencftp
orlftp
orftp
installed. I just happen to knowwget
the best. :)Edit To use
ftp
, you'll need to do something more like:At this point, note all the directories on the remote system. Create each one with
!mkdir
. Then change into the directory both locally and remotely:Repeat for all the directories. Use
mget *
to get all the files.If this looks awful, it is because it is. FTP wasn't designed for this, and if your new host doesn't have better tools (be sure to look for
ncftp
andlftp
and maybe something likeftpmirror
), then either compile better tools yourself or get good at writing scripts around the bad tools. :)Or if you could get a shell on
src
, that'd help immensely too. FTP is just not intended for transferring thousands of files.Anyway, this avoids bouncing through your local system, which ought to help throughput significantly.
总有值得信赖的 FUSE 文件系统,CurlFtpFS 和 SSHFS。使用适当的文件系统安装每个服务器,并使用标准实用程序进行复制。可能不是最快的方法,但很可能是最省力的方法。
There's always the trusty FUSE filesystems, CurlFtpFS and SSHFS. Mount each server with the appropriate filesystem and copy across using standard utilities. Probably not the fastest way to do it, but quite possibly the least labor-intensive.
我一直在寻找一种简单的解决方案,通过 FTP 将远程文件夹同步到本地文件夹,同时仅替换新文件。我遇到了一个基于 sarnold 的小
wget
脚本 的答案,我认为对其他人也可能有帮助,所以这里是:I was looking for a simple solution to sync a remote folder to a local folder via FTP while only replacing new files. I got stuck with a little
wget
script based on sarnold's answer that I thought might be helpful to others, too, so here it is: