Ubuntu – How to get a recursive ftp directory listing without write permissions

command lineftp

I know I can run ls * on the ftp server and get everything, but there's too much for my terminal (hundreds of pages so far). using ls * > myfile isn't an option because I don't have permission to write. So I need a way to do it from the terminal, something like: ftp ftp://site.com

I've read the man pages but don't want to take a risk here. I don't have personal permission to modify this server but the user I've been given may have write permissions.

I need to export this to any local format so I can review it over time, as there is a lot of output.

Best Answer

Apparently you can pipe a command directly to ftp:

echo "ls *" | ftp hostname > ls.txt

Make sure to quote ls * somehow or to disable globbing otherwise * will expand in the current shell.

Related Question