Touch
From FreeBSDwiki
(Difference between revisions)
m |
|||
Line 5: | Line 5: | ||
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. | 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] | + | [[Category:System Commands]] |
Latest revision as of 09: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.