Author Topic: A little tool to change date and time of a file  (Read 550 times)

jj2007

  • Member
  • *****
  • Posts: 8736
  • Assembler is fun ;-)
    • MasmBasic
A little tool to change date and time of a file
« 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
  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:
Code: [Select]
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

  • Regular Member
  • *
  • Posts: 47
  • Never be pleased, always improve
    • Grincheux's Tools
Re: A little tool to change date and time of a file
« Reply #1 on: December 09, 2017, 08:07:38 AM »
Great Thank Master; :eusa_boohoo:
Kenavo
---------------------------
Grincheux / Jokaste