FTP“重命名”命令将匹配通配符远程文件 [英] FTP 'rename' command to move remote files matching wildcard

查看:1217
本文介绍了FTP“重命名”命令将匹配通配符远程文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个 *。蝙蝠文件(Windows)中,我使用的FTP命令来获取远程文件回本地机器上。远程目录包括在其中我想一旦他们在本地机器上下载到移动文件的归档子目录中。

I'm writing a *.bat file (Windows) in which I use FTP commands to get remote files back on a local machine. The remote directory includes a archive subdirectory in which I want to move the files once they are downloaded on the local machine.

我在 *蝙蝠文件脚本:

My script in the *.bat file:

ftp -v -i -s:GET_FILES_FTP.txt

我的脚本 GET_FILES_FTP.txt

My script in GET_FILES_FTP.txt:

open example.com
username
password
lcd S:\
lcd repository/files
mget *.txt
rename *.txt archive/
disconnect
bye

需要注意的是主机名,用户名和密码不是那些我用真实的!

Note that hostname, username and password are not those I use for real!

的TXT文件在本地机器上正常下载。

The TXT files are downloaded properly on the local machine.

问题是,重命名* .TXT文档/ 不跨preTED和文件不移动到存档文件。我命令窗口,我收到了目录未找到的错误消息。我无法找到额外的信息比这个 DOC 更好。

The problem is that rename *.txt archive/ is not interpreted and the files do not move to the archive file. I the command window, I get a directory not found error message. I can't find extra information better than this doc.

这是如何移动文件的任何想法?

Any idea on how to move the files?

推荐答案

改名窗口 Ftp.exe的的命令不支持通配符。

The rename command of Windows ftp.exe does not support wildcards.

您必须动态地生成一个基于下载文件为每个文件单独的改名命令列表上的脚本文件。

You would have to dynamically generate a script file based on a list of downloaded files with a separate rename command for each file.

或者使用重命名/移动的时候,支持通配符不同的命令行FTP客户端。

Or use a different command-line FTP client that supports wildcards when renaming/moving.

例如与 WinSCP赋予脚本批处理文件会是这样:

For example with WinSCP scripting the batch file would be like:

winscp.com /log=winscp.log /command ^
    "open ftp://username:password@example.com" ^
    "lcd S:\" ^
    "lcd repository\files" ^
    "get *.txt" ^
    "mv *.txt archive/" ^
    "exit"

有关详细信息,请参阅:

For details see:

  • mv command
  • Converting Windows FTP script to WinSCP FTP script

(我的WinSCP的作者)

这篇关于FTP“重命名”命令将匹配通配符远程文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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