Home Forums .NET libraries Xceed SFTP/FTP for .NET Create a copy of a remote file?

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

    I was wondering the best way to create a copy of a file on an FTP server.

    While I am connected to my remote FTP server, I would like to place a copy of a file that is in my current folder, into another folder on the same server.

    Thanks in advance!

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

    User (Old forums)
    Member
    Post count: 23064

    You can use the RenameFile method on FtpClient. Here is how it works (taken from the help documentation ):

    By default, the file will be renamed in the current working folder. If you want to rename the file in another location, you could use the ChangeCurrentFolder and/or ChangeToParentFolder methods to change the current working folder. Absolute paths can also be provided, however some FTP servers might not support absolute paths and different server types may have different ways of representing absolute paths.

    The current working folder can be retrieved via the GetCurrentFolder method.

    The RenameFile method will send the RNFR and RNTO commands to the FTP server.

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

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