I copy some directories with -a
in order to preserve=all
which I understood would include creation times:
cp -a ./* /mnt/destination/
When inspecting the resulting directories in the destination they all have creation time set to the current time, while their contents seem to have preserved their creation times.
Why aren't the creation dates of the top level directories preserved?
The source is HFS+ and the destination is btrfs.
Excerpts of directory listings of destination and source:
$ ls -hal --time=creation
total 16K
drwxrwxr-x 1 andreas andreas 74 sep 2 23:25 .
drwx------ 1 andreas andreas 310 apr 26 17:08 ..
drwx------ 1 andreas andreas 2,3K sep 2 23:45 Library
$ ls -hal --time=creation /mnt/source
total 8,1M
drwxrwxr-x 1 andreas andreas 15 mar 28 2022 .
drwxr-x---+ 3 root root 4,0K aug 9 2022 ..
drwx------ 1 andreas andreas 95 apr 15 2019 Library
Update
Judging by the answers and comments I concluded that I must have made a mistake when I inspected the dates of subdirectories. I did. My fault — my expectations of the result blinded me of what I was looking at. That part of the question has been dropped.
ls
outputs. The first indicator was in the "Created" column in Ubuntu's Files app though. Not sure of the exact details needed to recreate it, but it's from files copied by macOS to a HFS+ formatted USB stick to btrfs on a USB attached HDD, using Ubuntu 23.04 on a Raspberry Pi 4. The example shows my macOS user's Library directory copied "exactly" by macOS Ventura's Finder onto the source volume.cp
as well.