3

I'm trying to copy files from an AFP share to an SMB share.

Several files on the AFP share have a ? in the name. If I try to copy them, I get invalid argument'.

I don't know how the files got the ? in the name in the first place.

Here is an example:

user$ cp tes?t /mnt/share/
cp: tes?t: invalid argument

I have tried to rename the file, but I get a 'resource busy' error message.

What can I do so that I can copy the files?

MDMarra
  • 101,323

3 Answers3

3

Escape the question mask with a backslash:

$ cp tes\?t /mnt/share/
quanta
  • 52,423
0

Is removing the ? an option? That's an invalid character for a file or pathname under NTFS-compatible filesystems, as it's actually a one-character wildcard.

The resource busy error is probably a result of the ? being interpreted as a wildcard, and the filesystem trying to access all the possible, invalid filenames it thinks that might stand for.

I'm fairly positive you'll have to access the files from a filesystem that doesn't consider ? an invalid character (is it a valid character on Macs?) to replace the ? with a valid one.

HopelessN00b
  • 54,273
0

The ? symbols represent unrecognized characters.

Most likely the problem here is that AFP uses UTF-8 filenames, but you are not logged in to the system that mounted the AFP share using a UTF-8 locale. If it's a Linux box, you can check your locale using the locale command.

If you find it's not using a UTF-8 locale, you can temporarily change the locale with something like:

export LC_ALL="en_US.UTF-8"
Michael Hampton
  • 252,907