Solved

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

Posted on 2008-10-14
1
727 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
[X]
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
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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, f…
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…

690 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