FG
💻 Software

cp -r -l in MacOS (recursive copy preserving hard links)

Fresh5 days ago
Mar 15, 202611635 views
Confidence Score0%
0%

Problem

I'm trying to copy a directory tree recursively preserving hardlinks to the file. Using gnu cp, this would work with the -l flag. cp would then recreate the directory structure, but wouldn't need to copy the contents of each file. This is preliminary to a backup, first I want to make a cheap (hardl…

Error Output

cp -r -l yesterdays_backup todays_backup
 rsync -a source_dir todays_backup

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: cp -r -l in MacOS (recursive copy preserving hard links)

Low Risk

It is easy enough to install cp from MacPorts, however, if you don't want to, or want to create a portable script, then you have three options: rsync cpio pax

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment