File.touch

You're seeing just the function touch, go back to File module for more information.
Link to this function

touch(path, time \\ System.os_time(:second))

View Source

Specs

touch(Path.t(), erlang_time() | posix_time()) :: :ok | {:error, posix()}

Updates modification time (mtime) and access time (atime) of the given file.

The file is created if it doesn't exist. Requires datetime in UTC (as returned by :erlang.universaltime()) or an integer representing the POSIX timestamp (as returned by System.os_time(:second)).

In Unix-like systems, changing the modification time may require you to be either root or the owner of the file. Having write access may not be enough. In those cases, touching the file the first time (to create it) will succeed, but touching an existing file with fail with {:error, :eperm}.

Examples

File.touch("/tmp/a.txt", {{2018, 1, 30}, {13, 59, 59}})
#=> :ok
File.touch("/fakedir/b.txt", {{2018, 1, 30}, {13, 59, 59}})
{:error, :enoent}

File.touch("/tmp/a.txt", 1544519753)
#=> :ok