Home Forums .NET libraries Xceed SFTP/FTP for .NET FtpClient object out of an FtpConnection object

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

    Hello,

    i have an simple application with FTP, implicit FTPS and explicit FTPS. So the SnippetExplorer-Sample was very usefull for me.
    I only want to copy all files of a local folder to an ftp-folder.

    DiskFolder df = new DiskFolder(folder);
    FtpFolder ff = new FtpFolder(connection);               
    string[] filter = new string[1];
    filter[0] = “*.zip”;                        
    df.CopyFilesTo(ff, false, true, filter);

     It works with a few files. If the local folder contains more then 3 files i’ll get an error, but this is not the question.

    One requirement on my application is to store each file under a different name on the ftp-server until the file is not fully transfert. After the transfer is completed i have to rename the file on the ftp-server to the original name.

    I think it is better for my application  to work with the FtpClient class. The class gives me more flexibility.

    Is it possible to get an object of the FtpClient class out of an FtpConnection object?
    For the connection with FTP, implicit FTPS and explicit FTPS the SnippetExplorer-Sample is very usefull but i’am not able to get on object of the FtpClient class by using the FtpConnect.

    Thanks for your help.

    Jan

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

    Xceed Support
    Member
    Post count: 5658

    Hi Jan,

     

    Getting an
    object of the FtpClient from an FtpConnection object is not a supported feature
    of the Xceed FTP for .NET component.

    An example
    of the use of that class is displayed on:

    http://doc.xceedsoft.com/products/XceedFileSystem/FTPComponent_Secure_FTP.html

        ***

    Using the FileSystem interface, you can transfer a file with a different target
    name:

    DiskFolder df = new DiskFolder(folder);

    // Get the files we want to copy
    AbstractFile[] files = df.GetFiles( false, “*.zip” );

    FtpFolder ff = new FtpFolder( connection );

    // Get a file on our target that has the name we want. It doesn’t have to exist
    AbstractFile targetFile = ff.GetFile( “MyTargetFilename.dat” );

    // Copy the source to the destination
    files[ 0 ].CopyTo( targetFile, true );
    //etc…

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Mohamed [Xceed] (had 238 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Mohamed,

    thanks for your reply. Your suggestion works.

    I still have the problem to send more than 3 files with the copy methods of an FtpConnection object. I reported this problem to support (

    case number 133456).

    At the moment i’ll try a workaround with an FtpClient object. The transfer works, but how can i transfer a file with a different target name out of an FtpClient object.

    I tried the SendFileToUniqueName method but my FTP-Server doesn’t except this command.

    (000009) 11.05.2010 09:52:54 – FtpUser (127.0.0.1)> STOU
    (000009) 11.05.2010 09:52:54 – FtpUser (127.0.0.1)> 500 Syntax error, command unrecognized.

     Regards 

     Jan

     

     

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

    User (Old forums)
    Member
    Post count: 23064

    Hi Mohamed,

    it works with the FtpClient object. I can set a different target name by using the SendFile method.

    Thanks for your help.

     

    Jan

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

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