pavement

Touch

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
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]

Revision as of 09:09, 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.

[Category:System Commands]

Personal tools