Move files after upload on local server

Advertisement

medicstuder
Joined:
Posts:
1
Location:
Georgia

Move files after upload on local server

I am working on a C# console program. So far it is working great. What it does is log into the remote SFTP server and copy files from our server to theirs. What I want it to do after the files are copied is move the local files from the current directory to a "sent" directory.

Here is what I have (it does not throw an errors and when testing the log shows the mv sourcepath to backuppath, but the files still remain in the sourcepath and never appear in the backup path.

transferResult = session.PutFiles(OutboundPath, UploadPath, false, transferOptions);
transferResult.Check();
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
Console.WriteLine("Upload of {0} succeeded", transfer.FileName);
session.MoveFile(transfer.FileName, backuppath);
}

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum