Jump to content


Photo

Setting modify time for a file.


  • Please log in to reply
9 replies to this topic

#1 ds1

ds1
  • Members
  • 15 posts

Posted 23 February 2011 - 04: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

#2 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 23 February 2011 - 04:43 AM

What is your license key id?

#3 ds1

ds1
  • Members
  • 15 posts

Posted 23 February 2011 - 04:01 PM

I am using the evaluation version for testing.

#4 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 24 February 2011 - 06:11 AM

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

#5 ds1

ds1
  • Members
  • 15 posts

Posted 07 March 2011 - 05:30 AM

We just purchased the library, the key id is 400135631

#6 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 07 March 2011 - 04:26 PM

Are you passing the time in UTC to the function?

#7 ds1

ds1
  • Members
  • 15 posts

Posted 08 March 2011 - 04:26 AM

Yes, the time is passed in UTC.. Can you please provide a sample on how to use "SetModifyTime"

Edited by ds1, 08 March 2011 - 04:27 AM.


#8 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 08 March 2011 - 06:35 AM

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

#9 ds1

ds1
  • Members
  • 15 posts

Posted 10 March 2011 - 08: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.

#10 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 10 March 2011 - 02: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.co...ases/view/17579

Alternatively just fill the long value into the sfFTPLib._FILETIME struct.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users