Join Date: Apr 2004
Last Activity: 1 December 2014, 9:03 AM EST
Location: Bordeaux, France
Thanked 61 Times in 57 Posts
From the touch man page :
The touch command updates the access and modification times of each file
specified by the File parameter of each directory specified by the Directory
parameter. If you do not specify a value for the Time variable, the touch
command uses the current time. If you specify a file that does not exist, the
touch command creates the file unless you specify the -c flag.
The return code from the touch command is the number of files for which the
times could not be successfully modified (including files that did not exist and
were not created). Note Any dates beyond and including the year 2038 are
. . . . . . . . .
1. To update the access and modification times of a file, enter:
This sets the last access and modification times of the program.c file to
the current date and time. If the program.c file does not exist, the touch
command creates an empty file with that name.
2. To avoid creating a new file, enter:
touch -c program.c
3. To update only the modification time, enter:
touch -m *.o
This updates the last modification times (not the access times) of the
files that end with a .o extension in the current directory. The touch
command is often used in this way to alter the results of the make command.
4. To explicitly set the access and modification times, enter:
touch -c -t 02171425 program.c
This sets the access and modification dates to 14:25 (2:25 p.m.) February
17 of the current year.
5. To use the time stamp of another file instead of the current time, enter:
touch -r file1 program.c
This gives the program.c file the same time stamp as the file1 file.
6. To touch a file using a specified time other than the current time, enter:
touch -t 198503030303.55 program.c
This gives the program.c file a time stamp of 3:03:55 a.m. on March 3,