如何在Windows批处理文件中编写命令将zip文件从FTP路径复制到计算机中的本地文件夹

时间:2022-02-26 16:45:49

I want to copy a zip file from an FTP path to a local folder in my computer.

我想将一个zip文件从FTP路径复制到我的计算机中的本地文件夹。

My client previously used coreftp.exe for that purpose. But now he ask us to use ftp.exe [default in windows machine, available at C:\Windows\System32\ftp.exe] for that purpose. The ftp is in the format :

我的客户端以前使用coreftp.exe来实现此目的。但是现在他要求我们使用ftp.exe [在Windows机器中默认,在C:\ Windows \ System32 \ ftp.exe中可用]。 ftp的格式为:

ftp://username@ftpserver.address.com 

And want to download it to d:\sample\docs folder on my machine.

并希望将其下载到我的机器上的d:\ sample \ docs文件夹中。

I want that in a batch file so that I can schedule it through windows task manager.

我希望在批处理文件中,以便我可以通过Windows任务管理器安排它。

So could you please help me to write that command on the batch file.

那么请你帮我在批处理文件上写这个命令。

Thanks a lot in advance.

非常感谢提前。

1 个解决方案

#1


FTP.EXE is capable of executing script files. So you could just put this into your bat file:

FTP.EXE能够执行脚本文件。所以你可以把它放到你的bat文件中:

@ECHO OFF
CD d:\sample\docs
FTP -v -i -s:C:\some\path\ftpscript.txt

And something like this into your ftpscript.txt:

在你的ftpscript.txt中有这样的东西:

open ftp://ftpserver.address.com
username
password
cd myfolder
get some_zip_file.zip
disconnect
bye

This will download some_zip_file.zip into the current directory (d:\sample\docs).

这会将some_zip_file.zip下载到当前目录(d:\ sample \ docs)。

#1


FTP.EXE is capable of executing script files. So you could just put this into your bat file:

FTP.EXE能够执行脚本文件。所以你可以把它放到你的bat文件中:

@ECHO OFF
CD d:\sample\docs
FTP -v -i -s:C:\some\path\ftpscript.txt

And something like this into your ftpscript.txt:

在你的ftpscript.txt中有这样的东西:

open ftp://ftpserver.address.com
username
password
cd myfolder
get some_zip_file.zip
disconnect
bye

This will download some_zip_file.zip into the current directory (d:\sample\docs).

这会将some_zip_file.zip下载到当前目录(d:\ sample \ docs)。