Handling locked files

Advertisement

torix
Joined:
Posts:
16
Location:
Norway

Handling locked files

We are utilizing WinSCP in conjunction with Powershell and Bitvise SSH Server and generally everything is working great. Our only problem seems to occur when transferring, and replacing, files that the user has opened and somewhat locked in e.g. Excel. In this situation we do not expect this solution to force an overwrite but just skip it and resume with the rest. What we observe is that the file transfer operation is aborted altogether and that subsequent files are missed. From start we ran with the resume option for these transfers but alter decided to disable it.

We have seen this when both using SynchronizeDirectories, Putfiles and GetFiles.

Anyone got similar experiences and solutions?

Reply with quote

Advertisement

torix
Joined:
Posts:
16
Location:
Norway

Re: Handling locked files

Thanks for the update and the solution you provided is in the same direction as I though of. Is this an issue that you will look into as an enhancement later? It would be better to track this situation in the events (transfer progress, file transferred) from the Error property.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: Handling locked files

Sure, I'm considering some improvements in this area.

Reply with quote

torix
Joined:
Posts:
16
Location:
Norway

Re: Handling locked files

That's great. Although it is possible to work around this issue by looping each file, it will be better to handle it in the multi file methods internally. This will make the code more compact and it will ease the cleanup of empty folders if the move option is used.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: Handling locked files

That's not really related.

Reply with quote

torix
Joined:
Posts:
16
Location:
Norway

Re: Handling locked files

Until a permanent fix is available, we have mitigated by working through the folder content and transferring file for file.

Although read-only (RO) files are our worst enemy, we generally want to preserve the RO attribute from source to destination. In short - a file with the RO attribute set should have this attribute set on the destination file system. Our observation is that RO source files end up on the target file system with RO cleared. Is this by design or will certain class properties need to be set for this attribute to be maintained?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: Handling locked files

WinSCP does not support preserving hidden attribute, when uploading, as very few servers do support it.

Though your server might support it actually.

Reply with quote

Advertisement

torix
Joined:
Posts:
16
Location:
Norway

Re: Handling locked files

martin wrote:

WinSCP does not support preserving hidden attribute, when uploading, as very few servers do support it.

Though your server might support it actually.

Hi,

You mention the hidden attribute - I referred to the read-only attribute. I see that functionality to preserve RO is a selectable option in the GUI-application. Not avaliable through the .Net libraries?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: Handling locked files

Sorry for the mistake. It does not change my answer though.

The option is available for download only (even in GUI), not for upload.

Reply with quote

Advertisement

You can post new topics in this forum