質問
FTPクライアントで grep
および ls
を使用するにはどうすればよいですか...
使用できる特定のファイルを見つけたい場合:
ls -l | grep pattern
解決
lftp は、入力したとおりにできます。
他のヒント
通常のUnixコマンドラインインタラクティブftpの場合、1つのアプローチは次のとおりです。
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.e。、まずdirの結果をローカルファイルに取り込み、 then grepをローカルで実行します。ちなみに、これにより、1回の dir
データ転送の支払い後に複数のgrepsを実行できます;-)。
Windowsでは、FTPを含む任意のプロトコルの WinSCPスクリプトを使用してこれを行うことができます。 :
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
所属していません StackOverflow