FTP get all files

10,474

Another simple solution is ....

List the files in an array and download each file individually.

Something like:

$contents = ftp_nlist($conn_id, ".");

foreach ($contents as &$value) { $result = ftp_fget($conn_id, $local,&$value, FTP_BINARY); }

You might need to tweak the code a little...

Share:
10,474
terrid25
Author by

terrid25

please delete me

Updated on August 31, 2022

Comments

  • terrid25
    terrid25 over 1 year

    I have successfully connected to my FTP using PHP and I can see all the files using: ftp_nlist

    But, is there an easy way to then download all these files in the current directory?

    I can't see to find any examples of how I'd do this.

    Thanks