Is there an efficient way to check the existence of a file on a FTP server? I’m using Apache Commons Net. I know that I can use the listNames
method of FTPClient
to get all the files in a specific directory and then I can go over this list to check if a given file exists, but I don’t think it’s efficient especially when the server contains a lot of files.
Advertisement
Answer
listFiles(String pathName)
should work just fine for a single file.