Update the last-modified timestamp on a file to the current time.


In the Julia programming language, the function touch(path::AbstractString) is used to update the last-modified timestamp of a file to the current time.

julia> touch("myfile.txt")

This example updates the last-modified timestamp of the file "myfile.txt" to the current time.

Common mistake example:

julia> touch("nonexistent_file.txt")
ERROR: SystemError: opening file "nonexistent_file.txt": No such file or directory

In this example, the function fails because the specified file does not exist. It's important to ensure that the file exists before using touch.

See Also

abspath, basename, chmod, countlines, cp, ctime, dirname, download, evalfile, expanduser, fdio, filemode, filesize, functionloc, gperm, homedir, include_string, isabspath, isblockdev, ischardev, isdir, isdirpath, isexecutable, isfifo, isfile, islink, ismount, ispath, isreadable, issetgid, issetuid, issticky, iswritable, joinpath, less, lstat, mkdir, mkpath, mktemp, mktempdir, mtime, mv, normpath, operm, poll_fd, poll_file, readall, readcsv, readdir, readdlm, readlines, readlink, realpath, relpath, rm, splitdir, splitdrive, splitext, stat, symlink, tempdir, tempname, touch, truncate, uperm, watch_file, writecsv,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field

Checking you are not a robot: