pavement

Touch

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
m
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
touch creates empty files
+
'''touch''' creates empty files, or updates the modification times on existing files if the user running '''touch''' has write permission to do so.
 +
 
 +
If you attempt to '''touch''' a file which already exists but you do not have write permissions to, or '''touch''' a new file in a directory in which you do not have write permissions, you will get a "Permission Denied" error.  Otherwise it quietly succeeds and simply updates the mtime on the file / creates a new file with the specified name.
 +
 
 +
This is mostly useful for scripting operations in which you want to make sure a file exists to be opened before attempting to open it.
 +
 
 +
[[Category:System Commands]]

Latest revision as of 10:10, 29 September 2004

touch creates empty files, or updates the modification times on existing files if the user running touch has write permission to do so.

If you attempt to touch a file which already exists but you do not have write permissions to, or touch a new file in a directory in which you do not have write permissions, you will get a "Permission Denied" error. Otherwise it quietly succeeds and simply updates the mtime on the file / creates a new file with the specified name.

This is mostly useful for scripting operations in which you want to make sure a file exists to be opened before attempting to open it.

Personal tools