I can't change a file’s access and modification times. When I enter touch t- CCYYMMDDhhmm.SS file.example
, I get "permission denied". It works for other files. I tried to use chmod +x file.example
but I am not sure I am using it correctly. What should I write, please ?
MacOS – Permission denied when I try to change a file’s access and modification times
catalinamacosterminal
Related Question
- MacOS – permission denied mkdir /Volumes
- MacOS – Batch copy time creation and modification date from files using OSX
- MacOS – terminal mac – bash command not found, permission denied and ‘>’ in prompt
- SSH with key passphrase not working
- MacOS – Tried to do a complete fresh install of Sierra. “Permission Denied” when I go to Install
Best Answer
The command should be
touch -t (date) file.example
chmod +x
just makes the file executable – it should not affect the date - but if you still want to use it, you can do it like this:Also, check that you have write permissions on the file by running
ls -l file.example
(or right-click on the file in Finder and choose Get Info, then look at 'Sharing & Permissions').