touch(3)

touch3

Set file access and modify times

Usage

$1$2#include <ast.h>#include <ast.h>#include <ast.h>#include <ast.h>#include <ast.h>#include <ast.h>#include <ast.h>#include <ast.h>

$1$2int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);int touch(const char* path, time_t atime, time_t mtime, int force);

Overview

$1$2touchtouchtouchtouchtouchtouchtouchtouch sets the access and modify times of the file named by $1$2pathpathpathpathpathpathpathpath If $1$2force != 0force != 0force != 0force != 0force != 0force != 0force != 0force != 0 then the file is created if it doesn't exist; otherwise the file is not created and $1$2-1-1-1-1-1-1-1-1 is returned. If $1$2force < 0force < 0force < 0force < 0force < 0force < 0force < 0force < 0 then $1$2atimeatimeatimeatimeatimeatimeatimeatime and $1$2mtimemtimemtimemtimemtimemtimemtimemtime are taken verbatim; otherwise $1$2(time_t)(-1)(time_t)(-1)(time_t)(-1)(time_t)(-1)(time_t)(-1)(time_t)(-1)(time_t)(-1)(time_t)(-1) retains the current value for the file and $1$2(time_t)(0)(time_t)(0)(time_t)(0)(time_t)(0)(time_t)(0)(time_t)(0)(time_t)(0)(time_t)(0) uses the current time.

Caveats

By default the change time is always changed to the current time.

Releases

Unchanged in 135 releases since Mac OS X 10.4.

  1. 10.4–26.5

From ksh 42 in macOS 26.5. Parsed by carta from the page's man source.