检查是否通过FTP文件存在 [英] check to see if file exists via FTP

查看:231
本文介绍了检查是否通过FTP文件存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我传送通过FTP文件,并希望能够以检查是否该文件已经存在...

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

我猜是使用 doesFileExist ,但似乎无法找到这样做的通过FTP例如

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

我google'd等,但似乎无法找到正确的答案。

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

谁能帮助?

推荐答案

有两种可能答案:

1)检查FTP服务器上的文件的传统方式是大小命令 - 如果你得到一个大小,该文件存在,否则你会得到一个。错误,你知道它不存在。

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)找到了一些代码,演示了一个可能的方式做到这一点:

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

获取文件大小

希望这有助于

这篇关于检查是否通过FTP文件存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆