Skip to main content

touch

Function touch 

Source
pub fn touch(files: &[InputFile], opts: &Options) -> Result<(), TouchError>
Expand description

Execute the touch command.

§Errors

Possible causes:

  • The user doesn’t have permission to access the file
  • One of the directory components of the file path doesn’t exist.
  • Dangling symlink is given and -r/–reference is used.

It will return an Err on the first error. However, for any of the files, if all of the following are true, it will print the error and continue touching the rest of the files.

  • opts.strict is false
  • The file doesn’t already exist
  • -c/--no-create was passed (opts.no_create)
  • Either -h/--no-dereference was passed (opts.no_deref) or the file couldn’t be created