在 Windows 命令行中将子文件夹上传到 FTP

发布于 2024-10-05 23:55:18 字数 167 浏览 0 评论 0原文

我必须在 Windows 上通过命令行上传整个文件夹。我无法让它上​​传子目录(包括其文件)。

ftp
open snuzzer.dk
username
password
mput *.*

这只会上传根目录中的所有文件。

谁能帮助我吗?

I have to upload an entire folder commandline on Windows. I can't get it to upload the subdirectories including it's files.

ftp
open snuzzer.dk
username
password
mput *.*

This only uploads all files in the root.

Can anyone help me?

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

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

发布评论

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

评论(3

情栀口红 2024-10-12 23:55:18

Windows 命令行 ftp.exe 客户端不支持(子)文件夹操作。

您必须使用第 3 方 FTP 客户端。


例如,对于 WinSCP,您可以使用:

winscp.com /log=ftp.log /command ^
    "open ftp://username:[email protected]/" ^
    "put *" ^
    "exit"

有一个 将 Windows ftp.exe 脚本转换为 WinSCP 脚本。虽然更简单的是WinSCP GUI 为您生成脚本或批处理文件

(我是 WinSCP 的作者)

Windows command-line ftp.exe client does not support operations with (sub)folders.

You have to use a 3rd-party FTP client.


For example with WinSCP you can use:

winscp.com /log=ftp.log /command ^
    "open ftp://username:[email protected]/" ^
    "put *" ^
    "exit"

There's a guide for converting Windows ftp.exe script to WinSCP script. Though easier is to have WinSCP GUI generate the script or batch file for you.

(I'm the author of WinSCP)

拥有 2024-10-12 23:55:18

一种方法是将 ncftpput 与 -R 选项一起使用。

one way would be to use ncftpput with the -R option.

怎会甘心 2024-10-12 23:55:18

您可以使用批处理脚本为 ftp 创建命令文件,然后使用该文件发出 ftp 命令。

类似这样:

@ECHO OFF    
ECHO open snuzzer.dk>command.txt
ECHO username>>command.txt
ECHO password>>command.txt

FOR /F "delims=" %%A IN ('DIR /b /s /a-d "%1"') DO (
   ECHO put "%%A">>command.txt
)

ECHO close>>command.txt

ftp /s:command.txt

FOR 循环只是简单地重复创建所有文件的列表。

You could use a batch script that creates a command file for ftp and then issues the ftp command with that file.

Something liek this:

@ECHO OFF    
ECHO open snuzzer.dk>command.txt
ECHO username>>command.txt
ECHO password>>command.txt

FOR /F "delims=" %%A IN ('DIR /b /s /a-d "%1"') DO (
   ECHO put "%%A">>command.txt
)

ECHO close>>command.txt

ftp /s:command.txt

The FOR loop simply creates a list of all files recusively.

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