Results 1 to 5 of 5

Thread: Files and (writeable) dates

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    I know how to get different dates from files, but is there a way of setting a date / time in a file??


    Reading is easy:

    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set FSOf = FSO.GetFile(fFile)
    MsgBox FSOf.datecreated
    MsgBox FSOf.datelastmodified
    MsgBox FOSf.DateLastAccessed


    BUT how do I write into the date:
    FSOf.DateCreated = "12/12/2000 12:12:12" ???

    Thanks. Chris

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Location
    chicago (hope)
    Posts
    146

    Talking maybe...?

    Code:
    x = Date()
    y = Time()
    
    Time = *timeyouwant*
    Date = *dateyouwant*
    
    'make file...
    
    
    Time = y
    Date = x
    hope, it helped.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878

    Wink

    Thanks, but thats cheating!

    I don't think I will be able to do it that way, as the file might not be on my own PC.... And even if it is, some of my users wont have permission to change the date / time on their (NT) systems.

    Chris

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    You can set the time & date of a file to whatever you want with the SETFILETIME Api call found at : http://www.vbapi.com/ref/s/setfiletime.html

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Thanks.

    Very Useful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width