Main menu:

Site search

Categories

April 2024
M T W T F S S
« Mar    
1234567
891011121314
15161718192021
22232425262728
2930  

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