Home Forums .NET libraries Xceed SFTP/FTP for .NET Best way to upload/check if folder already exists?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21060 |

    Currently I have this.

    using (FtpConnection connection = new FtpConnection(hostname, port, username, password))
                {
                    DiskFolder source = new DiskFolder(source);
                    FtpFolder destination = new FtpFolder(connection, path);
                    source.CopyFilesTo(destination, true, true);
                }

     I was wondering what the best way is to have it check if the folder (in the path) exists. If it does, upload the files, if it doesn’t create the folder, then upload.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by anand (had 1603 views)

    User (Old forums)
    Member
    Post count: 23064

    When using the FileSystem (FtpConnection), it does it all for you automatically, that is, it verifies if the folder exists, and if not, creates it, so that you don’t need to verify it yourself.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 243 views)

    User (Old forums)
    Member
    Post count: 23064

    Hey, close this. I just figured out that it does this by its self!!

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by anand (had 1608 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.