DEF GetFileAttributesEx(3) ! "Kernel32","GetFileAttributesExA"
DEF FileTimeToLocalFileTime(2) !"Kernel32","FileTimeToLocalFileTime"
DEF FileTimeToSystemTime(2) !"Kernel32","FileTimeToSystemTime"
Proc Getweekday
Parameters day&
Return substr$("Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag",day& + 1,",")
endproc
proc GetAttribString
parameters attrib&
return if(testbit(attrib&,4),"<DIR> ","") \
+ if(testbit(attrib&,0),"r","-") \
+ if(testbit(attrib&,5),"a","-") \
+ if(testbit(attrib&,1),"h","-") \
+ if(testbit(attrib&,2),"s","-")
endproc
proc GetAttribute
parameters File$
Declare info#,file#,utc#,time#,Attrib&,size!,cwrite$,ctime$,awrite$,atime$,wwrite$,wtime$,size$,Attrib$
Declare cday$,aday$,wday$,return$
dim info#,36
dim file#, len(file$)+1
String file#,0 = file$
DIM utc#,8
DIM time#,16
GetFileAttributesEx(file#,0,info#)
Attrib& = long(info#,0)'Attribut
Attrib$ = GetAttribString(attrib&)
size! = (long(info#,28) * 65536 * 65536) + long(info#,32)'Filesize
Size$ = Format$("###,###,###,###,###.00",size!)
return$ = size$+"|"+attrib$
'-------------------------Erstellzeit
FileTimeToLocalFileTime(info#+4,utc#)
FileTimeToSystemTime(utc#,time#)
cwrite$=""
ctime$=""
if word(time#,0) >= 1601
cday$ = Getweekday(word(time#,4))
return$ = return$+"|"+cday$+"|"
cwrite$=Format$("00",word(time#,6))+"."+Format$("00",word(time#,2))+"."+Format$("00",word(time#,0))'Last written date
ctime$=Format$("00",word(time#,8))+":"+Format$("00",word(time#,10))+":"+Format$("00",word(time#,12))'last written time
else
cwrite$="00.00.00"
ctime$="00:00:00"
endif
return$ = return$+cwrite$+"|"+ctime$+"|"
'-----------------------------letzter Zugriff
FileTimeToLocalFileTime(info#+12,utc#)
FileTimeToSystemTime(utc#,time#)
awrite$=""
atime$=""
if word(time#,0) >= 1601
aday$ = Getweekday(word(time#,4))
return$ = return$+aday$+"|"
awrite$=Format$("00",word(time#,6))+"."+Format$("00",word(time#,2))+"."+Format$("00",word(time#,0))'Last written date
atime$=Format$("00",word(time#,8))+":"+Format$("00",word(time#,10))+":"+Format$("00",word(time#,12))'last written time
else
awrite$="00.00.00"
atime$="00:00:00"
endif
return$ = return$+awrite$+"|"+atime$+"|"
'--------------------------- Zuletzt geschrieben
FileTimeToLocalFileTime(info#+20,utc#)
FileTimeToSystemTime(utc#,time#)
wwrite$=""
wtime$=""
if word(time#,0) >= 1601
wday$ = Getweekday(word(time#,4))
return$ = return$+wday$+"|"
wwrite$=Format$("00",word(time#,6))+"."+Format$("00",word(time#,2))+"."+Format$("00",word(time#,0))'Last written date
wtime$=Format$("00",word(time#,8))+":"+Format$("00",word(time#,10))+":"+Format$("00",word(time#,12))'last written time
else
wwrite$="00.00.00"
wtime$="00:00:00"
endif
return$ = return$+wwrite$+"|"+wtime$
Dispose info#
Dispose file#
Dispose UTC#
Dispose time#
return return$
endproc
cls
Var t$ = GetAttribute("C:\Autoexec.bat")'Hier Dateipfad
'print t$
print "Filesize:",subStr$(t$,1,"|")
print "Attribut:",subStr$(t$,2,"|")
Print "----------------------"
print "Erstelltag:",subStr$(t$,3,"|")
print "Erstelldatum:",subStr$(t$,4,"|")
print "Erstellzeit:",subStr$(t$,5,"|")
Print "----------------------"
print "Letzter Zugriff Tag:",subStr$(t$,6,"|")
print "Letzter Zugriff Datum:",subStr$(t$,7,"|")
print "Letzter Zugriff Zeit:",subStr$(t$,8,"|")
Print "----------------------"
print "Zuletzt geschrieben Tag:",subStr$(t$,9,"|")
print "Zuletzt geschrieben Datum:",subStr$(t$,10,"|")
print "Zuletzt geschrieben Zeit:",subStr$(t$,11,ot;|")
waitinput