News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A little tool to change date and time of a file

Started by jj2007, December 09, 2017, 06:27:15 AM

Previous topic - Next topic

jj2007

Usage is straightforward: Just drag the file over the attached ChangeFileDateAndTime.exe

Only minimal error checking - use at your own risk, and test it with less valuable files. Here is the source:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  .if Exist(CL$())
        PrintLine Str$(GfSize(-1)), Tb$, GfDate$(-1), Spc2$, GfTime$(-1), Tb$, Exist$
        @@:
        Let esi=Input$("Edit the file time and date: ", Cat$(GfDate$(-1)+" "+GfTime$(-1)))
        .if Len(esi)
                .if Instr_(esi, ".")!=3
                                PrintLine "Bad date format"
                                jmp @B
                .endif
                .if Instr_(esi, ":")!=14
                                PrintLine "Bad time format"
                                jmp @B
                .endif
                Inkey "Press y to confirm that you want to change the file date and time"
                .if eax=="y"
                                Touch CL$(), TimeSF(esi)
                .endif
        .endif
  .else
        MsgBox 0, "Drag a file over the exe", "Hi", MB_OK
  .endif
EndOfCode


Typical dialog:2161    08.12.2017  20:00:00    ChangeFileDateAndTime.asc
Edit the file time and date: 08.12.2017 20:00:00
Press y to confirm that you want to change the file date and time


Use the arrow and backspace keys to navigate inside the 08.12.2017 20:00:00 part.

Jokaste

Kenavo
---------------------------
Grincheux / Jokaste