Problem with file attributes using cp -Rp

While executing


cp -Rp /Users/xxxx/Directory_Name /Volumes/Backup/Directory_Name


where xxxx represents my user-name and same thing for Directory_Name and File_name


I got the following error message

cp: fchflags: /Volumes/Backup/Directory_Name/File_Name.txt: Invalid argument


So I looked at the attributes. Nothing for the standard ones but something for the extended ones obtained with xattr -l


Source:

xattr -l File_Name.txt

com.apple.TextEncoding: utf-8;134217984

com.apple.lastuseddate#PS: ??'e

com.apple.macl:

com.apple.metadata:kMDLabel_w3vm6mn2ztywmrwdcjm6otzsxm: ??^<`??~/?LT??)??$??m??????u?z%ڀS?̕m??3Ym|?HЦ??+?ƌʎ?++*uf?a0


Destination

xattr -l File_Name.txt

com.apple.TextEncoding: utf-8;134217984

com.apple.lastuseddate#PS: ??'e

com.apple.macl:

?ƌʎ?++*uf?a0tadata:kMDLabel_w3vm6mn2ztywmrwdcjm6otzsxm: ??^<`??~/?LT??)??$??m??????u?z%ڀS?̕m??3Ym|?HЦ??+??k}???


So it appears in the last line that

com.apple.me

has been changed into

?ƌʎ?++*uf?a0

I suspect some character encoding is malfunctioning.


Any idea on how to solve the problem ?


Some extra data

System version : macOS 12.7.6 (21H1320)

Kernel version : Darwin 21.6.0


External drive

Type de volume : Unknown

Nœud d’appareil BSD : disk5s1

File system : ExFAT

Connexion : USB



Posted on Apr 7, 2025 03:35 AM

Reply
Question marked as Top-ranking reply

Posted on Apr 8, 2025 09:33 AM

Bezout_Avon_Other wrote:

Thank you for the suggestion. But I do need to keep the attributes. My problem is that some (out of many) are corrupted. Is there a way to prevent this corruption, namely to have -p working properly

Use a functional file system like APFS.


Recent versions of macOS are using experimental new versions of FAT filesystems. I think your old version of Monterey might actually be using the older versions, but clearly it isn't working for you.


See Picking the Right Drive Format: ExFat is Not Your Friend

Similar questions

4 replies
Question marked as Top-ranking reply

Apr 8, 2025 09:33 AM in response to Bezout_Avon_Other

Bezout_Avon_Other wrote:

Thank you for the suggestion. But I do need to keep the attributes. My problem is that some (out of many) are corrupted. Is there a way to prevent this corruption, namely to have -p working properly

Use a functional file system like APFS.


Recent versions of macOS are using experimental new versions of FAT filesystems. I think your old version of Monterey might actually be using the older versions, but clearly it isn't working for you.


See Picking the Right Drive Format: ExFat is Not Your Friend

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Problem with file attributes using cp -Rp

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.