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
  • 100,183
  • 32
  • 195
  • 326
WinstonSmith
  • 31
  • 1
  • 2
  • Do you get the same error when copying from the AFP share to another place in the AFP share? (E.g. is the error on cp's read from AFP, on on the write to the SMB share (with NTFS behind it?) – Hennes Aug 03 '12 at 13:31

3 Answers3

3

Escape the question mask with a backslash:

$ cp tes\?t /mnt/share/
quanta
  • 50,327
  • 19
  • 152
  • 213
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
  • 53,385
  • 32
  • 133
  • 208
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
  • 237,123
  • 42
  • 477
  • 940