title: How do I pipe the output of an LS on remote server to the local filesystem via SFTP?
body: <p>I'm logged into a remote server via SFTP at the command line.  The folder I'm in contains hundreds of thousands of files.  I need to get a list of these files in a text file so I can access them programmatically, as none of the PHP SFTP clients are able to return such a large list of files.</p>
  
  <p>When I run an <code>ls</code> on the directory ( within the SFTP session ), it takes about 20 minutes for the file list to finally display.</p>
  
  <p>I don't have write access on this server, so I can't pipe the output to a file on the remote server.</p>
  
  <p>How can I pipe the output to a text file on my local machine ... or get a list of the files to my local machine some other way?</p>