我如何在FTP客户端中使用 grep ls ...

我的意思是,如果我想找到一些我可以使用的特定文件:

 ls -l | grep pattern
有帮助吗?

解决方案

lftp 可以完全按您输入的方式进行。

其他提示

使用通常的Unix命令行交互式ftp,一种方法是:

Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir . foobar
output to local-file: foobar [anpqy?]? y
500 Unknown command
227 Entering Passive Mode (62,149,140,15,195,159)
150 Accepted data connection
 11966       5.26 KB/s 
226-Options: -a -l 
226 156 matches total
ftp> !grep con foobar
-rwxr-xr-x    1 11050207   users          911007 Sep 13  2007 accu_pyconc.pdf
-rwxr-xr-x    1 11050207   users         9805405 Mar 25  2009 pycon_abst.pdf

即,首先将dir结果放入本地文件,然后在本地运行grep。顺便说一句,这可以让你在支付一个 dir 数据传输后运行多个greps; - )。

在Windows上,您可以使用 WinSCP脚本来执行此任何协议(包括FTP) :

winscp.com /command ^
    "open ftp://username:password@example.com" ^
    "ls /path/*.txt" ^
    "exit"

参考文献:结果 https://winscp.net/eng/docs/scripting
https://winscp.net/eng/docs/scriptcommand_ls

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top