Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change date and time of files
#2
Code:
Copy      Help
str sFile="$desktop$\test.txt"

dll kernel32 #CreateFile $lpFileName dwDesiredAccess dwShareMode SECURITY_ATTRIBUTES*lpSecurityAttributes dwCreationDisposition dwFlagsAndAttributes hTemplateFile
dll kernel32 #SetFileTime hFile FILETIME*lpCreationTime FILETIME*lpLastAccessTime FILETIME*lpLastWriteTime
def FILE_WRITE_ATTRIBUTES (0x100)
def OPEN_EXISTING 3

int hfile=CreateFile(_s.expandpath(sFile) FILE_WRITE_ATTRIBUTES 0 0 OPEN_EXISTING 0 0)
if(hfile=-1) end _s.dllerror()

DATE d.getclock
FILETIME ft ftutc
d.tofiletime(ft)
LocalFileTimeToFileTime &ft &ftutc
SetFileTime hfile 0 0 &ftutc

CloseHandle hfile


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)