使用 FTP 将文件上传到多个文件夹

发布于 2024-11-08 16:48:01 字数 1539 浏览 0 评论 0原文

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

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

发布评论

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

评论(3

寂寞陪衬 2024-11-15 16:48:01

这是我在浏览 docs 后发现的教程:

  1. 下载并安装WinSCP 并运行它
  2. 连接到服务器
  3. 转到菜单 > 会话 > 服务器/协议信息
  4. 复制“<一个href="https://winscp.net/eng/docs/scripting#hostkey" rel="nofollow noreferrer">服务器主机密钥指纹" (ssh-rsa 2048 xx:xx:xx:xx ...")

现在创建一个名为 upload.txt 的文件,添加以下内容(并根据需要进行修改):

# Connect
open sftp://user:[email protected]/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
# Change remote directory
cd /home/user/public
# Download file to the local directory d:
get robots.txt d:\
# Upload file to current working directory
put d:\examplefile.txt 
# Disconnect
close
# Exit WinSCP
exit

接下来创建一个批处理文件 run.bat > 使用正确的路径:

"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="C:\folder-with-uploadfile\upload.txt"
pause

运行批处理 检查示例文件

robots.txt 是否已下载到文件夹 D: 以及 examplefile.txt 是否位于服务器上的示例文件

夹中:https://winscp.net/eng/docs/script_upload_multiple_servers

PS:我是长期用户FileZilla,但到 2018 年 2 月他们还没有这个功能。所以 WinSCP 为+1。

Here is a tutorial that I figured out after going through the docs:

  1. Download and install WinSCP and run it
  2. Connect to Server
  3. Go to Menu >Session >Server/Protocol Information
  4. Copy the "Server host key fingerprint" (ssh-rsa 2048 xx:xx:xx:xx...")

Now create a file named upload.txt, add the following content (and modify as needed):

# Connect
open sftp://user:[email protected]/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
# Change remote directory
cd /home/user/public
# Download file to the local directory d:
get robots.txt d:\
# Upload file to current working directory
put d:\examplefile.txt 
# Disconnect
close
# Exit WinSCP
exit

Next create a batch file run.bat with the right paths:

"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="C:\folder-with-uploadfile\upload.txt"
pause

Run the batch file.

Check if the exampe file robots.txt was downloaded to folder D: and if examplefile.txt is in the example folder on the server.

In case of multiple servers: https://winscp.net/eng/docs/script_upload_multiple_servers

PS: I am a long-time user of FileZilla, but by Feb 2018 they do not have this feature yet. So +1 for WinSCP.

七分※倦醒 2024-11-15 16:48:01

据我所知,任何客户端都没有内置此功能,甚至 FTP 协议也没有内置此功能。

模仿这一点的一个客户端是 Cyber​​duck ,它具有“同步”功能,允许对您的文件夹进行任何更改使用时间戳同步上传到 FTP 服务器。

This feature isn't built into any client that I know of, or even the FTP protocol for that matter.

One client that mimics this is Cyberduck with it's "Synchronize" feature, allowing any changes on the folders you sync to be uploaded to the FTP server using timestamps.

染墨丶若流云 2024-11-15 16:48:01

您可以使用任何支持目录同步的 FTP 客户端。

以WinSCP为例:
https://winscp.net/eng/docs/task_synchronize

(我是WinSCP的作者)

You can use any FTP client that supports directory synchronization.

WinSCP for instance:
https://winscp.net/eng/docs/task_synchronize

(I'm the author of WinSCP)

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