i would like to be able to
chmod
a directory structure without changing the atime
of those (files and) directories.
if i start out with a file structure like
$ tree test/
test/
├── test1.txt
└── text2.txt
and list the atime
s of the files and directories
$ find test/ -exec stat --printf='name: %n atime: %x\n' {} \;
name: test/ atime: 2019-02-28 11:28:24.418369586 +0100
name: test/text2.txt atime: 2019-02-28 11:28:03.609919183 +0100
name: test/test1.txt atime: 2019-02-28 11:27:58.101799544 +0100
and then chmod
those with
$ chmod -R 'u=Xrw,g=Xrw,o=Xr' test
this changes the atime
s of the directories (and yes, for good reasons); the mtime
s remain unaffected:
$ find test/ -exec stat --printf='name: %n atime: %x\n' {} \;
name: test/ atime: 2019-02-28 11:38:30.590740343 +0100
name: test/text2.txt atime: 2019-02-28 11:28:03.609919183 +0100
name: test/test1.txt atime: 2019-02-28 11:27:58.101799544 +0100
is there a simple way to avoid that? i could of course write a script, that stores the atime
before the modification and then resets it afterwards. but is there a simpler way?
Asked by hiro protagonist
(258 rep)
Feb 28, 2019, 10:45 AM
Last activity: Feb 28, 2019, 01:01 PM
Last activity: Feb 28, 2019, 01:01 PM