Sample Header Ad - 728x90

Bash, the -nt fails when comparing two rsynced files between APFS and HFS+

0 votes
1 answer
43 views
While writing a backup Bash script, I've copied files from an APFS file system to an external drive that is HFS+ (I don't want to convert it to APFS because sometimes I need to read/write files with Linux, and apparently, there is no open source support for that). I have used --times with rsync and stat -f %m shows the same times at both ends. However, when I compare copies of the same file via:
$ [[ "$src" -nt "$bkp" ]] && echo "$src was updated"`
I always get that the source file is newer, even though I hadn't touched it after the copy. Another weird thing is that the older macos default Bash (v 3.x) works correctly.
Asked by zakmck (143 rep)
May 13, 2025, 03:51 PM
Last activity: May 13, 2025, 04:04 PM