Main menu:

Site search

Categories

December 2024
M T W T F S S
« Nov    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Tags

Blogroll

Words to the wise – recreating Unix’s touch function in Windows

Creating an empty file.

type nul >> your_file.txt
copy /b filename.ext +,,

The following works through a set of files in a directory and refreshes the date of them.  Useful if your company has a policy for deleting old files automatically, using Powershell.

(ls your-file-name-here).LastWriteTime = Get-Date
Get-ChildItem . * -recurse | ForEach-Object{$_.LastWriteTime = get-date}

https://docs.microsoft.com/en-us/sysinternals/downloads/file-and-disk-utilities

If you do this, it may be worth considering time stamping your files: textFile1_20180502.txt for example.

Write a comment