在FTP客户端中使用grep和ls?

在FTP客户端中使用grep和ls?,ftp,grep,ls,Ftp,Grep,Ls,如何在FTP客户端中使用grep和ls 我的意思是,如果我想找到一些我可以使用的特定文件: ls -l | grep pattern 对于常见的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 Ente

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

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

 ls -l | grep pattern

对于常见的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

i、 例如,首先将dir结果放入本地文件,然后在本地运行grep。顺便说一句,这让您只需支付一个
dir
data transfer;-)即可运行多个grep

可以,与您键入的方式完全相同。

在Windows上,您可以对任何协议执行此操作,包括FTP:

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


您可以将sftp文件夹装载到您有权使用grep或任何工具的主机上。

您需要进一步解释这个问题吗?什么FTP客户端?@Vijay:我的意思是我想让功能列出FTP服务器上的文件,并使用grep来过滤结果。我在Debian Lenny下使用FTP命令。谢谢。这是否意味着FTP客户端不支持类似shell的功能,例如管道,甚至不支持对其他命令(如grep)的内置调用…@jcyang,在Unix&c附带的股票ftp交互式命令行客户机中没有,但您当然可以编写不同的客户机:所以是关于开发软件,而不是使用现有程序(请参阅serverfault和superuser),对吗?因此,请用您选择的语言开始源代码,例如,为python编写大量的示例,并开始编写新的客户端程序,使其具有您认为应该具有的功能!谢谢。这正是我想要的。