ftp批处理文件将日志数据改为txt

时间:2021-11-25 02:23:24

me again :P I have some problems with some bat file, that bat file , connects to and ftp and download all files from a remote folder, then delete it, but my problem/question is: i need a txt(log) of every file before download it from the remote server, here is my file

我再说一遍:PI有一些bat文件,bat文件,连接到ftp和从远程文件夹下载所有文件,然后删除它有一些问题,但我的问题/问题是:我需要每个文件的txt(日志)在从远程服务器下载它之前,这是我的文件

bat file:

ftp -i -s:ftpfile.txt site.com

txt file

user-name
user-pass
lcd c:\localfolder\some\folder
cd remotefolder-name
mget . 
mdelete \\remotefolder-name\ .
quit

If i use the >>mylog.txt on this line:

如果我在这一行使用>> mylog.txt:

ftp -i -s:ftpfile.txt site.com>>mylog.txt

I get some extra data that i dont want to. I just need the file names before download it, something like this:

我得到了一些我不想要的额外数据。在下载之前我只需要文件名,如下所示:

log.txt

file001x.xml
filedfx.xml
file023x.xml
filed33x.xml

Ps:sorry for my english ;)

Ps:对不起我的英文;)

1 个解决方案

#1


0  

You may redirect ls output to local file. Syntax is: ls pattern local_file. An example would be: ls * ftplist.txt or ls . ftplist.txt. Both will produce a file ftplist.txt (in local current directory if you do not specify path) with a list of files (and possibly subdirs) in current directory on remote server (in slightly different formats)

您可以将ls输出重定向到本地文件。语法是:ls pattern local_file。一个例子是:ls * ftplist.txt或ls。 ftplist.txt。两者都会生成一个文件ftplist.txt(在本地当前目录中,如果你没有指定路径),在远程服务器上的当前目录中有一个文件列表(可能是子目录)(格式略有不同)

#1


0  

You may redirect ls output to local file. Syntax is: ls pattern local_file. An example would be: ls * ftplist.txt or ls . ftplist.txt. Both will produce a file ftplist.txt (in local current directory if you do not specify path) with a list of files (and possibly subdirs) in current directory on remote server (in slightly different formats)

您可以将ls输出重定向到本地文件。语法是:ls pattern local_file。一个例子是:ls * ftplist.txt或ls。 ftplist.txt。两者都会生成一个文件ftplist.txt(在本地当前目录中,如果你没有指定路径),在远程服务器上的当前目录中有一个文件列表(可能是子目录)(格式略有不同)