check to see if file exists via FTP

2019-08-03 20:17发布

问题:

I am transferring a file via FTP and want to be able to check if that file already exists...

i guess it is using doesFileExist but can't seem to find example for doing this over FTP

i have google'd etc but can't seem to find the right answer.

can anyone help?

回答1:

Two possible answers:

1) The traditional way to check for a file on an FTP server is the SIZE command - if you get a size, the file exists, otherwise you get an error and you know it doesn't exist.

2) Found some code that demonstrates a possible way to do this:

Get file size on FTP download

Hope this helps.