Jump to content

Touch -B


Recommended Posts

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

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

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

	   -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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...