rename file from terminal whenfile has xattr

I have files with xattr like this:

$ ll

total 10248

-rw-r--r--@ 1 udina staff 684414 Nov 2 11:58 SA_artista ceret-1.jpg

-rw-r--r--@ 1 udina staff 620273 Nov 2 11:59 SA_artista ceret-2.jpg

-rw-r--r--@ 1 udina staff 599247 Nov 2 12:02 SA_artista ceret-3.jpg


when I try to rename them from a bash script, it gives me error:

rename SA_artista ceret-6.jpg SA_artista-ceret-6.jpg

rename: SA_artista-ceret-6.jpg: not accessible: No such file or directory


How should I do it?

Thanks

MacBook Pro 16″, macOS 15.6

Posted on Nov 2, 2025 8:59 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 2, 2025 11:21 AM

What is “rename”? The command to rename files is called “mv”.


Also: the list is showing files that have a space in their names, which needs to be properly “escaped” by prefixing it with a backslash, or must be quoted.

For example,


mv “my file” my-file


Also, maybe it’s just that the list you show is incomplete, but you show files with -1, -2 or -3, but are trying to rename one with -6.

3 replies
Question marked as Top-ranking reply

Nov 2, 2025 11:21 AM in response to udina

What is “rename”? The command to rename files is called “mv”.


Also: the list is showing files that have a space in their names, which needs to be properly “escaped” by prefixing it with a backslash, or must be quoted.

For example,


mv “my file” my-file


Also, maybe it’s just that the list you show is incomplete, but you show files with -1, -2 or -3, but are trying to rename one with -6.

rename file from terminal whenfile has xattr

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