We sometimes need to run the touch command in Windows recursively, for example when we need to mark all files in a folder and its subfolders as modified. We tested the built-in touch command, as well as numerous touch-like third party tools, and ultimately concluded that the following PowerShell command is the easiest way to accomplish that:

dir -R | foreach { $_.LastWriteTime = [System.DateTime]::Now }

Suppose we want to touch all files in the C:\Projects\PlusInfinite\BoxToolkit, including the BoxToolkit folder itself. In that case we would replace with C:\Projects\PlusInfinite\BoxToolkit. If, on the other hand, we want to touch all files in that folder, excluding the folder itself, we would replace with C:\Projects\PlusInfinite\BoxToolkit\*.

Resources

Related posts.