javaguy Posted September 21, 2007 Report Share Posted September 21, 2007 The touch command used to have a -B option to set a file's timestamp relative to the current time. This doesn't seem to be around any more in Mandriva 2007. Is there an easy equivalent to it? Quote Link to comment Share on other sites More sharing options...
tyme Posted September 21, 2007 Report Share Posted September 21, 2007 man touch [i give you this link because it's easier than me trying to figure out whether you want to change the access time or the modified time or exactly what timestamp...plus, all the options are layed out there, and I know you're knowledgeable enough to find what you need :P] Obviously, doing man touch in a terminal on your own computer could possibly give you a more relevant man page. Quote Link to comment Share on other sites More sharing options...
javaguy Posted September 21, 2007 Author Report Share Posted September 21, 2007 Yeah, I looked at the man page. I don't see any way to do it any more. Quote Link to comment Share on other sites More sharing options...
iphitus Posted September 22, 2007 Report Share Posted September 22, 2007 Take a closer look: NAME touch - change file timestamps SYNOPSIS touch [OPTION]... FILE... DESCRIPTION Update the access and modification times of each FILE to the current time. It doesnt need an argument, just "touch somefile" to do what you want. James Quote Link to comment Share on other sites More sharing options...
neddie Posted September 22, 2007 Report Share Posted September 22, 2007 Come on guys, read what he said! :P The way I understood it, he doesn't want to set the timestamp to now, he wants to give a parameter so that the timestamp is relative to the current time, ie one hour ago or two days in the future. I've never seen an option to do that but then again I've never looked for it, never needed it. But that option is definitely not in the man page. It is listed here though. Quote Link to comment Share on other sites More sharing options...
tyme Posted September 24, 2007 Report Share Posted September 24, 2007 -d, --date=STRING parse STRING and use it instead of current time Saw that in the man page. Requires you to do the math yourself (or do a little BASH scripting), but it will set the time to what you want it to be. Quote Link to comment Share on other sites More sharing options...
javaguy Posted September 25, 2007 Author Report Share Posted September 25, 2007 That's what I ended up doing but was hoping to avoid. ;) The -B option was so convenient. I wonder why it was removed. Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted September 29, 2007 Report Share Posted September 29, 2007 Apparently they decided it wasn't needed anymore: http://www.gnu.org/software/coreutils/manu...in-date-strings [ohms@localhost ~]$ date Fri Sep 28 22:04:48 CDT 2007 [ohms@localhost ~]$ touch --date='-2 hours' somefile [ohms@localhost ~]$ ls -l somefile -rw-r--r-- 1 ohms guest 0 Sep 28 20:04 somefile [ohms@localhost ~]$ date Fri Sep 28 22:05:52 CDT 2007 [ohms@localhost ~]$ touch --date='-2 hours -5 minutes' somefile2 [ohms@localhost ~]$ ls -l somefile2 -rw-r--r-- 1 ohms guest 0 Sep 28 20:01 somefile2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.