dt-utils

A set of Windows utilities for files date and time manipulation.

Author: Vladimír Škach

Github: https://github.com/skachcz/dt-utils

Download binaries: dt-utils1.0.0.zip (26 kB)


In Windows, every file has three datetime attributes - created, last modified, and last accessed.

I created this set of utilities to list and manipulate mentioned dates.

DtDate

Returns current date and time

Possible format values:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

Default format: {0:yyyy-MM-dd-HH-mm}


  > DtDate  
  2019-03-20-10-04
  
  > DtDate --format="{0:yyyy}-{0:MM}"  
  2019-03  
  
  > DtDate --format="{0:HH}-x-{0:mm}"  
  10-x-04  


How to use command in windows batch file:

WARNING: In batch file you need to escape equal sign = with ^ like this: --format^="{0:yyyy-MM-dd}"`

Content of dtdate.bat:

FOR /F "tokens=* USEBACKQ" %%F IN (`c:\winapps\dt-utils\DtDate.exe --format^="{0:yyyy-MM-dd}"`) DO (
SET myDate=%%F
)

mkdir "backup-%myDate%"


The batch result:

c:\Script\test>dtdate.bat

c:\Script\test>FOR /F "tokens=* USEBACKQ" %F IN (`c:\winapps\dt-utils\DtDate.exe --format="{0:yyyy-MM-dd}"`) DO (SET myDate=%F )

c:\Script\test>(SET myDate=2019-03-22 )

c:\Script\test>mkdir "backup-2019-03-22"


DTlist

Lists files in directory with all times


> DTlist  

created                 accessed                modified               filename  
2019-03-20 10:02:42     2019-03-20 10:02:42     2019-03-20 10:16:40     DtDate.exe  
2019-03-19 10:53:29     2019-03-19 10:53:29     2019-03-19 11:04:02     DtGUI.exe  
2019-03-19 10:53:29     2019-03-19 10:53:29     2019-03-19 9:58:47      DtGUI.exe.config  
2019-03-19 10:53:29     2019-03-19 10:53:29     2019-03-19 11:04:02     DtGUI.pdb  
2019-03-19 11:05:04     2019-03-19 11:05:04     2019-03-19 9:57:36      DtLib.dll  
2019-03-20 10:19:49     2019-03-20 10:19:49     2019-03-20 10:19:35     Dtlist.exe  


DTsetdate

Set date(s) for specific file


> Dtlist.exe C:\i

Created                 Accessed                Modified                Filename  
2019-03-20 11:01:55     2019-03-20 11:01:55     2019-03-20 11:01:57     testfile.txt  
  
>Dtsetdate.exe "C:\i\testfile.txt" "2018-01-01" -set=c  
  
> Dtlist.exe C:\i  
Created                 Accessed                Modified                Filename  
2018-01-01 0:00:00      2019-03-20 11:01:55     2019-03-20 11:01:57     testfile.txt  

> Dtsetdate.exe "C:\i\testfile.txt" "2016-10-01 12:34:56" -set=acm  
  
> Dtlist.exe C:\i  
Created                 Accessed                Modified                Filename  
2016-10-01 12:34:56     2016-10-01 12:34:56     2016-10-01 12:34:56     testfile.txt  


DTsetdir

Set date(s) for files in directory

> Dtlist.exe c:\i  

Created                 Accessed                Modified                Filename  
2016-10-01 12:34:56     2016-10-01 12:34:56     2016-10-01 12:34:56     testfile1.txt  
2019-03-20 11:12:45     2019-03-20 11:12:45     2019-03-20 11:12:46     testfile2.txt  
2019-03-20 11:13:00     2019-03-20 11:13:00     2019-03-20 11:13:01     testfile3.txt  
  
> DtSetdir "C:\i" "*.*" "2016-07-08 10:00:00" -set=acm  
  
> Dtlist c:\i  

Created                 Accessed                Modified                Filename  
2016-07-08 10:00:00     2016-07-08 10:00:00     2016-07-08 10:00:00     testfile1.txt  
2016-07-08 10:00:00     2016-07-08 10:00:00     2016-07-08 10:00:00     testfile2.txt  
2016-07-08 10:00:00     2016-07-08 10:00:00     2016-07-08 10:00:00     testfile3.txt  
  
> DtSetdir "C:\i" "*.*" "2016-07-08 10:00:00" -set=acm -offset=+5s  
  
> Dtlist c:\i  

Created                 Accessed                Modified                Filename  
2016-07-08 10:00:00     2016-07-08 10:00:00     2016-07-08 10:00:00     testfile1.txt  
2016-07-08 10:00:05     2016-07-08 10:00:05     2016-07-08 10:00:05     testfile2.txt  
2016-07-08 10:00:10     2016-07-08 10:00:10     2016-07-08 10:00:10     testfile3.txt  


DT GUI

GUI application with the same ability as DTsetdir

You can change default directory in DtGUI.exe.config file.

dt gui