Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 3 '12 at 13:31
add comment

3 Answers

Escape the question mask with a backslash:

$ cp tes\?t /mnt/share/
share|improve this answer
add comment

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.

share|improve this answer
add comment

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"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.