2

I am trying to fetch and display the 'last-modification' of the file from my server using VBScript, It is successfully fetching the 'last-modified' details but the date and the time it fetched is wrong

Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
Set environmentVars = WScript.CreateObject("WScript.Shell").Environment("Process")
tempFolder = environmentVars("TEMP")
strURL = "http://testme.decentsms.com/gwbasic.rar"
strMethod = "GET"
objWinHttp.Open strMethod, strURL, False
objWinHttp.Send
GetDataFromURL = objWinHttp.GetResponseHeader("Last-Modified")
MsgBox GetDataFromURL

it fetch the following modified details,

Last-Modified: Mon 21 May 2012 20:06:51 GMT

while the actual file details are,

Tue 22 May 2012 1:06:51 GMT

I don't know what is wrong here, ? I'm not able to sort out the problem, is it because of the cache ?

1 Answer 1

2

Your script got some things mixed up, it's simple in fact, see this example, replace server and share with your path.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("\\server\share\gwbasic.rar")
Wscript.Echo "Date created:       " & objFile.DateCreated
Wscript.Echo "Date last accessed: " & objFile.DateLastAccessed
Wscript.Echo "Date last modified: " & objFile.DateLastModified
Wscript.Echo "Drive:              " & objFile.Drive
Wscript.Echo "Name:               " & objFile.Name
Wscript.Echo "Parent folder:      " & objFile.ParentFolder
Wscript.Echo "Path:               " & objFile.Path
Wscript.Echo "Short name:         " & objFile.ShortName
Wscript.Echo "Short path:         " & objFile.ShortPath
Wscript.Echo "Size:               " & objFile.Size
Wscript.Echo "Type:               " & objFile.Type
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.