English
Source / code snippets

File date prepares Filetimetolocalfiletime written Getfileattributesex Time grabbed

 
uncharted (14.10.2011)
CompileMarkSeparation
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
 
10/19/11  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.433 Views

Untitledvor 0 min.
H.Brill03/13/23
p.specht11/18/21
Wilfried Friebe11/17/21
Jürgen Strahl11/17/21
More...

Themeninformationen

this Topic has 1 subscriber:

iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie