Maintaining modify timestamps on directory tree #418
Replies: 2 comments 2 replies
-
Those are still absolute paths, since ~ translates into a top-level directory. So, yes it works fine with absolute paths. Remember that if you want a directory's attributes preserved, it must be a part of the transfer. Using --mkpath specifies directories that are outside the transfer. |
Beta Was this translation helpful? Give feedback.
-
To preserve a directory's attributes, it must be a part of the transfer. |
Beta Was this translation helpful? Give feedback.
-
I'll try to be brief on my initial post, and fill in any additional requested details as they come up. I'm using rsync to back up computers on my home network onto a QNAP NAS, also on the network. I mount the NAS locally so I don't need to supply credentials for every sync. My basic challenge is that rsync will not maintain the modify timestamp on all directories when syncing absolute directory paths. I'm testing from an msys2 environment on Windows 7 64-bit using a Samba mount, and from an Ubuntu MATE 22.10 64-bit virtual machine using and NFS mount.
With this, the modify timestamps on the top-level contains the current timestamp instead of the source timestamp. The timestamps on lower-level directories and individual files are all correctly maintained. I get the same results running from Ubuntu.
Following some suggestions I found via Google, I switched to relative directories:
This works perfectly. All directory timestamps are the same as on the source drive.
Should this work using absolute paths? Thanks.
[EDIT] I found a simpler way to demonstrate. NAS isn't required at all, I get the same results syncing between two local directories. Under Windows:
rsync -rltD --mkpath --delete /d/Projects-Linux/gcvs/ /d/test/Projects-Linux/gcvs/
Both the test and Projects-Linux directories end up with current timestamps. The gcvs directory and files within it maintain the source timestamps.
Beta Was this translation helpful? Give feedback.
All reactions