2014-02-11 00:35:16 +00:00
|
|
|
# touch
|
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
> Create files and set access/modification times.
|
2024-09-09 16:11:41 +01:00
|
|
|
> More information: <https://manned.org/touch>.
|
2014-02-11 00:35:16 +00:00
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
- Create specific files:
|
2014-02-11 00:35:16 +00:00
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
`touch {{path/to/file1 path/to/file2 ...}}`
|
2014-02-11 00:35:16 +00:00
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
- Set the file [a]ccess or [m]odification times to the current one and don't [c]reate file if it doesn't exist:
|
2014-02-11 00:35:16 +00:00
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
`touch -c -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
|
2021-10-29 18:43:29 +01:00
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
- Set the file [t]ime to a specific value and don't [c]reate file if it doesn't exist:
|
2021-10-29 18:43:29 +01:00
|
|
|
|
2022-12-15 12:28:53 +00:00
|
|
|
`touch -c -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
|
2014-02-11 00:35:16 +00:00
|
|
|
|
2024-05-15 11:45:04 +01:00
|
|
|
- Set the files' timestamp to the [r]eference file's timestamp, and do not [c]reate the file if it does not exist:
|
2014-02-11 00:35:16 +00:00
|
|
|
|
2024-05-15 11:45:04 +01:00
|
|
|
`touch -c -r {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}`
|