The MASM Forum

General => The Workshop => Topic started by: jj2007 on December 09, 2017, 06:27:15 AM

Title: A little tool to change date and time of a file
Post by: jj2007 on December 09, 2017, 06:27:15 AM
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 (http://masm32.com/board/index.php?topic=94.0)
  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.
Title: Re: A little tool to change date and time of a file
Post by: Jokaste on December 09, 2017, 08:07:38 AM
Great Thank Master; :eusa_boohoo: