Unix touch command for windows




















You are commenting using your Google account. You are commenting using your Twitter account. You are commenting using your Facebook account. Notify me of new comments via email. Notify me of new posts via email. Like this: Like Loading This worked with the normal Windows wildcards to re-up a bunch of pictures. Improve this question. The four alternatives mentioned above, plus four more not mentioned here, can be found in the answer to a similar question: "Windows Recursive Touch Command" — JdeBP.

Add a comment. Active Oldest Votes. Improve this answer. Community Bot 1. Gish Domains Gish Domains. In Win7 this won't work if you are not in the folder containing the file. It will create a copy in the current working directory.

Show 16 more comments. Greg Hewgill Greg Hewgill 5, 2 2 gold badges 27 27 silver badges 30 30 bronze badges. As almost every unix-to-windows port ever, this fails to work with unicode characters in the filenames outside of the encoding set as the default for non-unicode programs. Update from In Windows 10 we can use the Linux subsystem for windows, which installs bash. No need for cygwin, MinGW, unxutils or any other partial unix to windows ports. Davos have you tried that on any file other than your usually unprivileged user context?

Because technically the userland side of LXSS is running as unprivileged user. These days it's literally easier to install the code-signed package Git for Windows and use the touch from there, as in any case you can use it in any NT user context, whereas your suggestion limits you entirely to files and folders owned by the user starting the WSP app or at least those only accessible with the appropriate ACEs set to modify timestamps.

The above port should also work for the same reason. Show 4 more comments. ThiagoAlves ThiagoAlves 1, 1 1 gold badge 7 7 silver badges 3 3 bronze badges. PowerShell FTW. I mean, seriously, unix is cool but PS is cooler.

This will work only on one file. If you want to do it recursively, this works pretty well: gci -recu -inc ". Unix touch is great for it's simplicity. Leaves file contents alone. Just uses cmd built-ins. Both last-access and creation times updated. This doesn't work on read-only files, whereas touch does. Unfortunately this does not work at least not in Windows 7. It seems that the command interpreter does not update the timestamp of the destination of a redirection if the file is not actually modified i.

Faredoon Faredoon 4 4 silver badges 5 5 bronze badges. Now that's just messed up syntax. Seriously, what were they thinking? Also note the same documentation says "Destination: Required. I'm amazed. This doesn't seem to even work in Vista I wonder if they came to their senses? Works in Windows 7 — Imran. It worked for me even without commas: copy file. It worked in Windows Server but only if you are in the folder containing the file — FrinkTheBrave. Jose C - Jan 4. Debbie O'Brien - Jan Dima Grossman - Jan DEV Community is a community of , amazing developers We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in. Twitter Facebook Github Instagram Twitch. Open up your terminal and paste the following code. Now below we can see the touch-cli in action. It only updates last modification time. Skip to content. Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Previous Cat command in Linux with examples.



0コメント

  • 1000 / 1000