批量file upload.txt到FTP

我为此设置了一个单独的FTP帐户。

这里是信息:

FTP Username: ahk@proflightsimulatoreview.com FTP Server: ftp.proflightsimulatoreview.com FTP Server Port: 21 FTP Password: ahktest Text file i want to upload: C:\Users\Kyle\Desktop\ftptest\thetest.txt 

请告诉我如何批量执行此操作。 我的理解是你使用FTP命令创build一个单独的txt文件,然后使用batch file来运行它。 那么我一定没有插入信息的权利,因为它没有工作。

所以我在这里给你的信息。 请告诉我如何上传文本文件。

Solutions Collecting From Web of "批量file upload.txt到FTP"

我只是把HELLO.TXT放在你的ftp根目录下;

1 。 保存为MYFTP.bat

 @echo off echo user ahk@proflightsimulatoreview.com> ftpcmd.dat echo ahktest>> ftpcmd.dat echo put %1>> ftpcmd.dat echo quit>> ftpcmd.dat ftp -n -s:ftpcmd.dat ftp.proflightsimulatoreview.com del ftpcmd.dat 

2 。 从命令行,在与MYFTP.BAT相同的目录中,运行;

 MYFTP.BAT c:\temp\hello.txt 

结果

 220---------- Welcome to Pure-FTPd [privsep] [TLS] ---------- 220-You are user number 2 of 50 allowed. 220-Local time is now 05:17. server port: 21. 220 You will be disconnected after 15 minutes of inactivity. ftp> user ahk@proflightsimulatoreview.com 331 User ahk@proflightsimulatoreview.com OK. Password required 230-OK. Current restricted directory is / 230 0 Kbytes used (0%) - authorized: 51200 Kb ftp> put hello.txt 200 PORT command successful 150 Connecting to port 59363 226-0 Kbytes used (0%) - authorized: 51200 Kb 226-File successfully transferred 226 0.563 seconds (measured here), 14.20 bytes per second ftp: 8 bytes sent in 0.34Seconds 0.02Kbytes/sec. ftp> quit 221-Goodbye. You uploaded 1 and downloaded 0 kbytes. 221 Logout. 

我这样做了:

第一棒:

 startupload.bat ftp -i -s:upload.bat 

第二只蝙蝠:upload.bat:

 open ftp.yourserver.com username password cd public_html cd Ftp binary put C:\Users\Desktop\something.txt bye 

你可以通过打开startupload.bat运行它(如果不行的话,打开cmd.exe并将startupload.bat它上面,然后按下Enter键,它会告诉你问题在哪里)

像这样创建一个批处理文件:

 @echo off echo USERNAME> upload.txt echo PASSWORD>> upload.txt echo asc>>upload.txt echo put UPLOAD_FILE_NAME FTP_PATH_TO_STORE_FILE>> upload.txt echo quit >> upload.txt ftp -s:upload.txt SERVER_NAME.COM del upload.txt 

UPLOAD_FILE_NAME : – 您可以将文件上传到批处理文件所在的同一目录中,或者使用绝对路径给文件名。我需要上传一个名为register.exe的文件,我应该使用

如果register.exe存在于批处理目录或回声放在d:\ myfiles \ register.exe,如果register.exe是存在于另一个文件夹(d驱动器myfiles文件夹)

FTP_PATH_TO_STORE_FILE : – 这是我需要放置我的文件的FTP路径。例如/home/myftpfolder/register.exe

del upload.txt : – 它的可选项,因为当执行批处理文件时,这个upload.txt将会以FTP用户名和密码存储在目录中

如果我的服务器名称是theserver.com那么批处理文件应该写成像

 @echo off echo user123> upload.txt echo 123TTyyy#>> upload.txt echo asc>>upload.txt echo put register.exe /home/myfiles/register.exe>> upload.txt echo quit >> upload.txt ftp -s:upload.txt theserver.com del upload.txt 

上传到服务器的简单方法是创建一个脚本文件:
代码:

 ( echo USERNAME echo PASSWORD echo asc echo put C:\Users\Kyle\Desktop\ftptest\thetest.txt echo quit )>temp.txt ftp SERVER_DOAMIN -s:temp.txt del temp.txt /q >nul 

所以,USERNAME是一个用户名,PASSWORD是一个密码,SERVER_DOMAIN是一个服务器域(不是ftp://顶部)