Page 1 of 1

example for setAttributes

Posted: Mon 13 Aug 2012 11:50
by bilbo194
Hello,

I like to change the date of a file after uploaded it to a distant server to preserve to date after uploading (is it the right way to do that ?).

I try :

Code: Select all

   SFTP.UploadFile(sF,'/root/' + ExtractFileName(sF), false);
   attr.ValidAttributes := [aModifyTime] ;
   attr.ModifyTime := DateToSet;
   SFTP.SetAttributes('/root/' + ExtractFileName(sF),attr) ;
The date on the server is not changed

Distant server has OpennSSH on Debian
Sending server is Windows 2003
SecureBridgeVersion = '3.00.0.2';

Thanks for your help,
Jean-Michel

Re: example for setAttributes

Posted: Tue 14 Aug 2012 10:01
by AndreyZ
Hello,

You are using the correct way of setting the modify time of a remote file. Unfortunatelly, we cannot reproduce the problem with not setting the modify time by using the SetAttributes method. Please try using the OnSetRemoteFileAttributes event handler and check if the problem remains. The OnSetRemoteFileAttributes event occurs when copying a file from a local machine to a remote one during the UploadFile method call. On processing this event you can set the attributes for the remote file using the Attrs object.

Re: example for setAttributes

Posted: Tue 14 Aug 2012 16:20
by bilbo194
Hello,

It is only :

Code: Select all

	Attrs.ModifyTime := DateToSet
in SetRemoteFileAttributes ?

Because it does not change the date of the file.

Thanks for your help

Re: example for setAttributes

Posted: Thu 16 Aug 2012 12:26
by AndreyZ
Thank you for the information. We will fix this problem in the next SecureBridge version.