Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

andybruner

Re: error using move file

Yes, I am trying to move files, not a folder. I think your reply helped me. Thanks.
andybruner

Error using move file

I am getting this error when using move file. Can you help? Thanks.

General failure (server should provide error description).
Error code: 4
Error message from server: Failure

Here's my code:
using (Session session = new Session())
{
    // Connect
    string sftpFolder = "/parcs/download/" + mSysParam.Company;
    mLgr.LogInfo(sftpFolder);
    session.Open(sessionOptions);
 
    // download files
    TransferOptions transferOptions = new TransferOptions();
    transferOptions.TransferMode = TransferMode.Binary;
 
    TransferOperationResult transferResult;
    transferResult =
        session.GetFilesToDirectory(sftpFolder, mApplicationDataPath);
 
    localPPCounter++; //increase PP count so loop will stop
    //// Print results
    foreach (TransferEventArgs transfer in transferResult.Transfers)
    {
        mLgr.LogInfo("Download of file succeeded: " + transfer.FileName);
        mLgr.LogInfo("Destination:" + transfer.Destination);
    }
 
    session.MoveFile("/parcs/download/","/parcs/download/PNB/Processed");
}