I want to list all files on an FTP server using PHP. According to RFC 959 the FTP command LIST is allowed to print arbitrary human-readable information on files/folders, which seems to make it impossible to determine the file type correctly. But how do other FTP clients manage to distinguish files and folders? Is there an unwritten standard or such?
I want to list all files on an FTP server using PHP. According to
Share
I finally found the extension to the FTP protocol which implements the desired behaviour: the command is called MLSD and can be found on page 23 of RFC 3659. I’ll use that as default and try to parse the output of
LISTas if it was returned byls -las a fallback.