check to see if file exists via FTP

2019-08-03 19:40发布

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条回答
爷、活的狠高调
2楼-- · 2019-08-03 20:19

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.

查看更多
登录 后发表回答