批处理文件将目录中的所有文件上传到FTP [英] Batch file to upload all files in directory to FTP

查看:238
本文介绍了批处理文件将目录中的所有文件上传到FTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图制作一个bat脚本,将文件夹中的所有文件上传到FTP服务器。

I'm trying to make a bat script to upload all files from a folder to an FTP server.

我遵循以下指南并设法获取单个文件上传,但无法弄清楚如何上传文件夹中的所有内容。

I followed the below guide and manage to get a single file uploaded but can't figure out how to upload everything in the folder.

如何自动从Windows命令行上传FTP

How to Automate FTP Uploads from the Windows Command Line

从我读过的东西,我想我需要以某种方式使用mput命令?

From what I've read I think i need to somehow use the mput command?

目前我的upload.bat文件如下所示:

At the moment my upload.bat file looks like this:

myftp.bat .\logs\test.txt

在myftp.bat中是:

inside myftp.bat is:

@echo off
echo user MyUserName> ftpcmd.dat
echo MyPassword>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat MyFTPServer
del ftpcmd.dat
pause


推荐答案

您需要使用 mput 命令,例如:

You need to use mput command like:

cd logs
prompt
mput *

没有 提示符命令,您将被要求确认每次转账。

Without prompt command, you would get asked to confirm each transfer.

取代 prompt 命令,您也可以使用 -i 开关:

Instead of the prompt command, you can also use the -i switch:

ftp -i -n -s:ftpcmd.dat MyFTPServer

这篇关于批处理文件将目录中的所有文件上传到FTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆