0

Using CURL and connecting by FTP, how do I list the contents of a remote directory? Instead of downloading a single file individually and having to know the filename, I have a requirement to download the whole remote directory (which will just be a bunch of text files).

Is there any way using FTP with cURL to either:

  1. Download all files in a directory
  2. List all files in a directory, so I can iterate over these and download.
j0k
  • 22,600
  • 28
  • 79
  • 90
Lock
  • 5,422
  • 14
  • 66
  • 113

1 Answers1

1

If you don't have to use cURL, try this guy.. It looks like this closer to what you are looking for!

Sebastian Frohm
  • 418
  • 5
  • 16
  • Yes I did see that, although I am tossing up whether to use cURL or native functions, as I have a few other protocols I will be using (SFTP and SCP). Are there similar libraries in PHP for these two? – Lock Dec 06 '12 at 21:44
  • If you need to SFTP and SCP, I'd probably just stick with cURL. I know they have built in functionality for those two protocols, so I think you'll be best off with that. Lemme know how it works out! – Sebastian Frohm Dec 20 '12 at 17:21
  • I ended up going with cURL.. quite successfully! Thankyou – Lock Dec 20 '12 at 21:58