TOUCH Command

HSI Version: 

All

Purpose: 

Updates last access time for existing files, creates new (0-length) file if file does not exist. 

Aliases: 

 

Command
Format:
 

tou[ch] [-a][-c cosID] [-f] [-l localfile] [-M mode] [-m] [-R] [-r HPSS_file] [-t timestamp] [-x] path ...

Options: 

-a: change access time of file.  Modification time is not changed unless the "-m" flag is also specified


-c : specifies Class of Service ID to be used.  The string "auto" can be specified to cause HSI's automatic Class of Service selection algorithm to be used.   This is the normal default, but "-c auto" can be used to temporarily override any current COS ID that was previously set by a "set cosid" command.


-f: reserved - currently unused


-l localfile:  use local file's timestamp instead of current time


-M: specifies octal mode flags to use for new file creation


-m: change modification time of file.  Access time is not changed unless the "-a" flag is also specified.


-R : [standard option] recursively traverse directories in the specified path(s) 


-r HPSS_file: use HPSS file's timestamp instead of the current time


-t timestamp: use [[CC]YY]MMDDhhmm[.ss] instead of the current time.

    CC is the optional century

     YY is the optional year

     MM is the month number (1-12)

     DD is the day number (1-n)

     hh is the hour (00-23)

     mm is the minute (00-59)

     ss is the optional second (0-59)


-x: do not create the file if it does not exist


Keywords: 

DIRn

Usage Notes: 

1. The options -a,-f,-l,-m,-r,-t and -x are available in HSI version 3.4.4  and beyond (for HPSS 6.2.x) and in HSI version 3.5.1 and beyond (HPSS 7.x)

2. The Class of Service IDs that are available at a site can be viewed by using the "LSCOS"

command.

Example: 

1. update timestamps for all files that end in ".c" or ".h"
   touch dir=sources *.c *.h
2. create a new empty file called "newFile" using Class of
Service ID 401, with permissions set to read-write for owner
and group
   touch -M 0662 -c 401 newFile
3. synchronize an HPSS file's  timestamp with that of its local file counterpart
         touch -l myfile.c  myfile.c
4. set the modify time of a file to April 1, 1949
         touch -t 194904010000 mikes_bd_cake

Related Command(s):