summaryrefslogtreecommitdiffstats
path: root/contrib/cmake/FileInformation.vbs
blob: c78cae075c4b1438cec2c6be72e8c63655d7aea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
' helper script for FileInformation CMake module


Function ToISODateTime(ByVal dt)
	ToISODateTime = CStr(Year(dt)) & "-" & _
		Right("00" & Month(dt), 2) & "-" & _
		Right("00" & Day(dt), 2) & "T" & _
		Right("00" & Hour(dt), 2) & ":" & _
		Right("00" & Minute(dt), 2) & ":" & _
		Right("00" & Second(dt), 2)
End Function

If WScript.Arguments.Count < 1 Then
	Wscript.Quit 1
End If

InputOption=WScript.Arguments.Item(0)

If InputOption = "--current_timestamp" Then
	Wscript.Echo ToISODateTime(Now)
	Wscript.Quit 0
End If

If WScript.Arguments.Count < 2 Then
	Wscript.Quit 1
End If

Set FSO=CreateObject("Scripting.FileSystemObject")
if FSO.FolderExists(WScript.Arguments.Item(1)) Then
	Set FSItem=FSO.GetFolder(WScript.Arguments.Item(1))
Else 
	Set FSItem=FSO.GetFile(WScript.Arguments.Item(1))
End If

If InputOption = "--size" Then
	Wscript.Echo CStr(FSItem.Size)
	Wscript.Quit 0
ElseIf InputOption = "--timestamp" Then
	Wscript.Echo ToISODateTime(FSItem.DateLastModified)
	Wscript.Quit 0
End If

Wscript.Quit 1