In Linux and Unix there is a “touch” command which will update the timestamp of a file without modifying the contents. You can also create an empty file without having to open an application among other actions. In Windows there isn’t a direct equivalent, but you can get close by using the “copy” command with a “+” at the end of the filename while specifying no destination file. The + symbol points the copy operation back to the source file. This will update the timestamp while not modifying the contents of the file.
Ex.
copy SampleFile.txt+
This process was helpful for my customer testing out automated CI/CD processes with Azure DevOps and Git. Hopefully this will be useful to someone else. Enjoy.
-Frog Out
Thank you! This worked with the normal Windows wildcards to re-up a bunch of pictures.
LikeLike
I like to use Directory Report. I can select multiple files to be touched. If I select a directory then it will touch all files in that directory.
LikeLike
Doesn’t get anymore keep-it-simple than this! Thanks.
LikeLike
In Windows 10, the timestamp is NOT updated. Plus, you have to add a “/Y” to the command to keep from being asked if you want to overwrite the file.
LikeLike
Very useful, thank you very much.
LikeLike
Does this no longer work?
I am getting this:
>copy index.js+
The system cannot find the file specified.
LikeLike
What host / shell are you running the command?
I am currently getting same error when running the above in PowerShell, but does work in CMD (command line). May be an update to PowerShell that changed as this previously did work at original publication.
LikeLike
it doesn’t work from cmd, either.
LikeLike