Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: Delete a file in Local server after transferring the file

What protocol are you using?
Can you post a session log file?
Though I do not think it's WinSCP that locks the file. Did you try to turn off antivirus?
Did you try using File.Move instead of File.Copy and File.Delete?
BLawrence

Delete a file in Local server after transferring the file

Dim transferOptions = New TransferOptions
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off
transferOptions.PreserveTimestamp = False

transferResult = session.PutFiles(UploadFromFolder + filename.FileName, ClientFolderPath, False, transferOptions)

transferResult.Check()
File.Copy(UploadFromFolder + filename.FileName, BackupFolder + Path.GetFileName(filename.FileName))

File.Delete(UploadFromFolder + filename.FileName)

File.Delete gives error that the file is used by another process and cannot delete. It is just a text file and the transfer somehow locks it I think.