1

I have to download a file by FTP, but I know just the prefix of the file, because the end of the name is generated by another system for me. With the function "mget", I can download, however I wish to do the same thing with PHP, but the function "ftp_get" isn't accepting * to get all the files in the directory. For example:

ftp> mget RPT_35302535*.*
ftp_get($Connection, $Local_Name, "RPT_35302535*.*", FTP_BINARY);

The function ftp_get needs the complete name and isn't accepting the * to get all the files.

How can I download a file like mget * with PHP?

Thanks!!

  • I'm not familiar with FTP in PHP, but I think you could solve this by first listing the directory and collecting the files that match the file(s) you need, then download each of them. – Kyrre Jan 16 '20 at 14:45
  • 1
    [This](https://stackoverflow.com/questions/29308061/using-php-ftp-get-to-retrieve-file-with-wildcard-filename) answer help you? – Simone Rossaini Jan 16 '20 at 14:51
  • Thanks all! I tried as this example and worked correctly! – Flávio Eduardo Jan 16 '20 at 15:19

0 Answers0