Setting modify time for a file.

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
Post Reply
ds1
Posts: 15
Joined: Fri Feb 04, 2011 4:59 am

Setting modify time for a file.

Post by ds1 » Wed Feb 23, 2011 4:31 am

I am trying to change the modified time of a file using the method "SetModifyTimeAsDate". The time of the file is changed on the server, however there is some diffrence between the time set and actual time of the file on the server. Can anyone assist with this?

Also I am not able to find details in the help file on how we can use the method "SetModifyTime" so can someone please provide a sample which specifies how I can set the exact time to the file. My application is in VB.net

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Setting modify time for a file.

Post by mb » Wed Feb 23, 2011 4:43 am

What is your license key id?

ds1
Posts: 15
Joined: Fri Feb 04, 2011 4:59 am

Re: Setting modify time for a file.

Post by ds1 » Wed Feb 23, 2011 4:01 pm

I am using the evaluation version for testing.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Setting modify time for a file.

Post by mb » Thu Feb 24, 2011 6:11 am

For technical support we usually ask clients to purchase a license.

ds1
Posts: 15
Joined: Fri Feb 04, 2011 4:59 am

Re: Setting modify time for a file.

Post by ds1 » Mon Mar 07, 2011 5:30 am

We just purchased the library, the key id is 400135631

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Setting modify time for a file.

Post by mb » Mon Mar 07, 2011 4:26 pm

Are you passing the time in UTC to the function?

ds1
Posts: 15
Joined: Fri Feb 04, 2011 4:59 am

Re: Setting modify time for a file.

Post by ds1 » Tue Mar 08, 2011 4:26 am

Yes, the time is passed in UTC.. Can you please provide a sample on how to use "SetModifyTime"
Last edited by ds1 on Tue Mar 08, 2011 4:27 am, edited 1 time in total.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Setting modify time for a file.

Post by mb » Tue Mar 08, 2011 6:35 am

Try something like this:
long filetime = DateTime.Now.ToFileTime();
_ftp.SetModifyTime(file, filetime);

ds1
Posts: 15
Joined: Fri Feb 04, 2011 4:59 am

Re: Setting modify time for a file.

Post by ds1 » Thu Mar 10, 2011 8:04 am

I tried to use above code but the method _ftp.SetModifyTime accepts second parameter as "sfFTPLib._FILETIME" and not in the long format.

Please give me another solution.

mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Setting modify time for a file.

Post by mb » Thu Mar 10, 2011 2:11 pm

The native FILETIME type should be imported as long by .NET. You may need the new tlbimp2 tool:
TlbImp2.exe from http://clrinterop.codeplex.com/releases/view/17579

Alternatively just fill the long value into the sfFTPLib._FILETIME struct.
Last edited by mb on Thu Mar 10, 2011 2:15 pm, edited 1 time in total.

Post Reply