Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Trying to get a directory list from Secure FTP into a text file

Posted on 2008-10-14
1
719 Views
Last Modified: 2013-12-13
Hello,

I need to run some queries on a list of filenames in a remote SFTP account. I'm not running the queries in FTP, I just need the list of filenames, then I'll run the parse them using PHP.

I've tried the following:

1) Connect to the SFTP account using PHP. I have OpenSSL installed. I've tried to connect using ftp_connect and ftp_ssl_connect, and on ports 21 and 22. The connection always fails. However, it connects fine using an FTP client on my computer (I use Secure File Transfer Client, FileZilla Client and PuttyFTP). The remote FTP server requires the connecton to be Secure FTP.

2) My 2nd option was to connect using an FTP client from my computer, then just copy the list of filenames into a text file, and then simply get my PHP script to read the text file rather than connecting to the FTP itself. However I can't get this to work either because I can't find an FTP client that will allow me to copy the full list of filenames (the list is very long). I can't even find a command line ftp with a copy function for this.

Please can you explain to me how to get the SFTP in PHP working, or let me know of an FTP client which will allow me to copy the directory listing to a text file.

Please help! Thanks!
0
Comment
Question by:flashjordan
1 Comment
 
LVL 4

Accepted Solution

by:
webopius earned 500 total points
ID: 22715541
Hi,

You can try this using your ftp client:

ls [remote-directory] [local-file]

For example, "ls . listing" will create a LOCAL file called "listing" containing all the files in the current ftp directory.

Many windows and unix ftp connections support this syntax.
Hope it works for you!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question