javaguy Posted September 21, 2007 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? Link to comment Share on other sites More sharing options...
tyme Posted September 21, 2007 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. Link to comment Share on other sites More sharing options...
javaguy Posted September 21, 2007 Author Share Posted September 21, 2007 Yeah, I looked at the man page. I don't see any way to do it any more. Link to comment Share on other sites More sharing options...
iphitus Posted September 22, 2007 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 Link to comment Share on other sites More sharing options...
neddie Posted September 22, 2007 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. Link to comment Share on other sites More sharing options...
tyme Posted September 24, 2007 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. Link to comment Share on other sites More sharing options...
javaguy Posted September 25, 2007 Author 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. Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted September 29, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now