Re: How can i check whether a file exists? - WeOnlyDo Discussion board

Re: How can i check whether a file exists? (General questions)

by wodDamir, Monday, March 19, 2012, 15:49 (4630 days ago) @ david.pearson@gmsl.co.uk

David,

You didn't mention that you're using Blocking mode in your initial post, so I assumed you were using asynchronous mode.

However, this works perfectly:
[code]
String fullRemotePath = /path/to/file/to/check ;
Ftp1.Rename(fullRemotePath , fullRemotePath );
[/code]

If file doesn't exist, an exception will be thrown immediately, and if it does, it will remain same sa it was, unchanged.

Please note that there is no command in FTP that does this. The above is only a workaround on how to achieve something that isn't implemented into the protocol itself.

As for CheckDir method, you can find help on it here.

Regards,
Damba


Complete thread: