Results 1 to 2 of 2

Thread: can I get the time a text file was created ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    UK
    Posts
    300
    I am writing a shop floor system and need to retrieve a text file every two hours from the NT server. In my program I would like to get the file and check the files time creation. This file called reeldata is created every two hours and the old file is overwritten with the new one. My process will collect the new file just after it has been created, but I would like to double check that the same file is not being retrieved twice ( it may occur that someone delays the process by 15 mins and in this case my process would collect the same file twice )if I could check the time the file was created , store the time then at the next collection I could compare the times. If it is greater than the stored previous time go ahead with the transfer if its the same then don't collect. Comprendy !

    How do I get the time stamp of the file from VB !

    Many thanks
    Locutus
    Resistance is futile

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Posts
    81
    Use the FileSystemObject ("Microsoft Scripting Runtime" reference needed):

    Code:
    Dim fso As New FileSystemObject
    Dim fil As File
    
    ' example
    Set fil = fso.GetFile("D:\Development\OutputInterface\OutputFormatInterface.ini")
    
    Debug.Print "File time: " & fil.DateCreated
    HTH!

    Toot
    Some cause happiness wherever they go; others, whenever they go.

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