Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.2k views
in .NET FTP by
Working with C#.

Using FTPClient.Dir("/remote/file.ext") to confirm the existence of a file returns a bad result.

Although the resulting string[].Length == 1 as expected (when the file exists), the contents are bad:

string[0] = "/remote/file.ext/file.ext"

It looks as is FTPClient.Dir(path) expects "path" to be a directory and uses it as a prefix in building the results.

TJ

3 Answers

0 votes
by (162k points)
You can't use Dir to confirm the existence of a file - not that way.

Use Dir("remote") to get the file list and see if it is there.

Working with C#.

Using FTPClient.Dir("/remote/file.ext") to confirm the existence of a file returns a bad result.

Although the resulting string[].Length == 1 as expected (when the file exists), the contents are bad:

string[0] = "/remote/file.ext/file.ext"

It looks as is FTPClient.Dir(path) expects "path" to be a directory and uses it as a prefix in building the results.

TJ
0 votes
by
Well the technique certainly works reliably in my application!
0 votes
by (162k points)
It *may* work, but is heavily dependent on how the FTP server handles directory listing requests.

Well the technique certainly works reliably in my application!

Categories

...