【问题标题】:Copy all files from one FTP directory to another将所有文件从一个 FTP 目录复制到另一个
【发布时间】:2016-09-08 06:45:28
【问题描述】:

我必须将一个 ftp 目录中的所有现有文件复制到另一台服务器上的另一个 ftp 目录。我没有任何编写脚本的经验 - 所以这方面的任何帮助都会很棒。

我想知道是否可以编写此脚本,使其每天在特定时间发生?

我应该为此使用什么软件/语言? Python 是众所周知的,但我想确保它符合我的要求。

有人可以给我一个基本的代码实现吗?

提前致谢

【问题讨论】:

标签: python shell ftp


【解决方案1】:

最后,您可能会将整个目录下载到本地计算机并重新上传到另一台计算机,因为通常无法在 FTP 中的目录之间复制文件。
FTP copy a file to another place in same FTP

您会发现大量的下载和上传示例。您甚至不需要脚本语言。只需使用一些命令行 FTP 客户端。

例如WinSCP FTP client,您可以使用以下批处理文件(.bat):

winscp.com /log=copy.log /command ^
    "open ftp://username:password@ftp.example.com/" ^
    "get /source/remote/path/* C:\temporary\local\path\" ^
    "put C:\temporary\local\path\* /destination/remote/path/" ^
    "exit"

请参阅Automating file transfers to and from FTP server 的指南。

(我是 WinSCP 的作者)

【讨论】:

  • 如果其他目录用户不同,这只是一个梦想!可能返回了Access Denied 消息。
  • @dsgdfg 当然可以,但看起来 OP 不想在用户之间复制文件。即使需要,您只需在 put 之前插入另一个 open 命令。
猜你喜欢
  • 2012-02-15
  • 2020-12-08
  • 2013-06-01
  • 2020-06-22
  • 2014-08-12
  • 2013-10-24
  • 2011-10-24
  • 1970-01-01
相关资源
最近更新 更多