Exists() public method

Tests to see if the SMB resource exists.
Tests to see if the SMB resource exists. If the resource refers only to a server, this method determines if the server exists on the network and is advertising SMB services. If this resource refers to a workgroup, this method determines if the workgroup name is valid on the local SMB network. If this SmbFile refers to the root smb:// resource true is always returned. If this SmbFile is a traditional file or directory, it will be queried for on the specified server as expected.
public Exists ( ) : bool
return bool
Example #1
0
 /// <summary>
 /// Creates a directory with the path specified by this <tt>SmbFile</tt>
 /// and any parent directories that do not exist.
 /// </summary>
 /// <remarks>
 /// Creates a directory with the path specified by this <tt>SmbFile</tt>
 /// and any parent directories that do not exist. This method will fail
 /// when used with <code>smb://</code>, <code>smb://workgroup/</code>,
 /// <code>smb://server/</code>, or <code>smb://server/share/</code> URLs
 /// because workgroups, servers, and shares cannot be dynamically created
 /// (although in the future it may be possible to create shares).
 /// </remarks>
 /// <exception cref="SmbException">SmbException</exception>
 /// <exception cref="SharpCifs.Smb.SmbException"></exception>
 public virtual void Mkdirs()
 {
     SmbFile parent;
     try
     {
         parent = new SmbFile(GetParent(), Auth);
     }
     catch (IOException)
     {
         return;
     }
     if (parent.Exists() == false)
     {
         parent.Mkdirs();
     }
     Mkdir();
 }