\r
return msg;\r
}\r
- \r
+\r
+ public bool DirectoryExists(string directory)\r
+ {\r
+ try\r
+ {\r
+ ChangeDir(directory);\r
+ ChangeDir("..");\r
+ return true;\r
+ }\r
+ catch (FtpException)\r
+ {\r
+ return false;\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Return the size of a file.\r
/// </summary>\r
\r
this.sendCommand( "CWD " + dirName );\r
\r
- if ( this.resultCode != 250 ) throw new FtpException(result.Substring(4));\r
+ if ( this.resultCode != 250 )\r
+ {\r
+ if (this.resultCode == 550)\r
+ throw new FtpException(String.Format("Access denied to {0}", this.remotePath + "/" + dirName));\r
+ throw new FtpException(result.Substring(4));\r
+ }\r
\r
this.sendCommand( "PWD" );\r
\r