All files in current folder were created on 24 of January 2021, time zone is GMT +3
1 2 3 4 5 6 7 8 9 |
$ ls -la --time-style=full-iso total 1268 drwxrwxrwx 10 nobody nogroup 4096 2021-01-24 14:21:32.630000000 +0300 . drwxrwxrwx 8 nobody nogroup 4096 2020-10-04 13:01:59.960000000 +0300 .. -rw-r--r-- 1 nobody nogroup 42313 2021-01-24 14:20:09.140000000 +0300 alternatives.log drwxr-xr-x 2 nobody nogroup 4096 2021-01-24 14:20:09.140000000 +0300 apt drwxr-xr-x 3 nobody nogroup 4096 2021-01-24 14:20:09.190000000 +0300 dist-upgrade -rw-r--r-- 1 nobody nogroup 913999 2021-01-24 14:20:09.210000000 +0300 dpkg.log drwxr-xr-x 2 nobody nogroup 4096 2021-01-24 14:20:09.210000000 +0300 journal |
Now let’s set their last access and modification time using a comination of find and touch commands. Please note ‘+3000’ at the end of the new date. We need this parameter in order to preserve our timezone.
1 |
$ find . -exec touch -d "2020-12-31 23:59:59.999999999 +0300" {} \; |
Run ‘ls’ again, just to check that the files were updated
1 2 3 4 5 6 7 8 9 10 |
$ ls -la --time-style=full-iso total 1268 drwxrwxrwx 10 nogroup nogroup 4096 2020-12-31 23:59:59.999999999 +0300 . # the parent folder was not changed and that is OK drwxrwxrwx 8 nogroup nogroup 4096 2020-10-04 13:01:59.960000000 +0300 .. -rw-r--r-- 1 nogroup nogroup 42313 2020-12-31 23:59:59.999999999 +0300 alternatives.log drwxr-xr-x 2 nogroup nogroup 4096 2020-12-31 23:59:59.999999999 +0300 apt drwxr-xr-x 3 nogroup nogroup 4096 2020-12-31 23:59:59.999999999 +0300 dist-upgrade -rw-r--r-- 1 nogroup nogroup 913999 2020-12-31 23:59:59.999999999 +0300 dpkg.log drwxr-xr-x 2 nogroup nogroup 4096 2020-12-31 23:59:59.999999999 +0300 journal |
Looks good!