将目录中的所有文件上传到 FTP 的批处理文件 [英] Batch file to upload all files in directory to 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.
根据我的阅读,我认为我需要以某种方式使用 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 est.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屋!