W3cubDocs

/Nushell

touch for filesystem

Creates one or more files.

Signature

> touch {flags} (filename) ...rest

Flags

  • --reference, -r {string}: change the file or directory time to the time of the reference file/directory
  • --modified, -m: change the modification time of the file or directory. If no timestamp, date or reference file/directory is given, the current time is used
  • --access, -a: change the access time of the file or directory. If no timestamp, date or reference file/directory is given, the current time is used
  • --no-create, -c: do not create the file if it does not exist

Parameters

  • filename: the path of the file you want to create
  • ...rest: additional files to create

Input/output types:

input output
nothing nothing

Examples

Creates "fixture.json"

>touchfixture.json

Creates files a, b and c

>touchabc

Changes the last modified time of "fixture.json" to today's date

>touch-mfixture.json

Changes the last modified time of files a, b and c to a date

>touch-m-d"yesterday"abc

Changes the last modified time of file d and e to "fixture.json"'s last modified time

>touch-m-rfixture.jsonde

Changes the last accessed time of "fixture.json" to a date

>touch-a-d"August 24, 2019; 12:30:30"fixture.json

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/touch.html