Can't copy file with double quotes - invalid argument or no such file

0

We've got an old system with a write protected (qstar tape) filesystem on it and I'm trying to copy all the files off there before it's canned.

CentOS release 6.9 (Final) - 2.6.32-696.23.1.el6.x86_64

I'm unsure how the files got on here like this in the first place, but they are listing as this when I do ls -l:

??????????? ? ?    ?             ?            ? Item from 23"2"60 with special chars.xml

If it was just the spaces, it would be fine, but the " marks seem to be really causing all sort of bother. Also because of the read only file system (tapes) I can't just rename the file in situ.

If I try an ls (I get the same if I escape the " too)

# ll Item\ from\ 23"2"60\ with\ special\ chars.xml
ls: cannot access Item from 23"2"60 with special chars.xml: No such file or directory

If i try other command (such as a find on the directory) I get this error:

find: `./Item from 23"2"60 with special chars.xml': Invalid argument

I'm hoping there's some way I can copy this file to somewhere writable (or mounted) and change the filename to remove/change the characters when copied.

--

I've tried a few other things I've found without success:

# pax -rw -s '/[?<>\\:*|\"]/_/gp' *chars.xml /mnt/writable/place/
pax: Unable to access Item from 23"2"60 with special chars.xml: Invalid argument
pax: WARNING! These file names were not selected:
Item from 23"2"60 with special chars.xml

Using single quotes:

# cp 'Item from 23"2"60 with special chars.xml' /mnt/writable/place/
cp: cannot stat `Item from 23"2"60 with special chars.xml': No such file or directory

Notes: Parent directory file permissions are all (and I am logged in as root):

drwxrwxrwx. 2 root root       2048 Jun 23  2014

Sample File listing (showing other files that are fine):

-rwxrwxrwx. 1 root root       10031 Jun 24  2014 Sports Preview 12-3-60.xml
-rwxrwxrwx. 1 root root  4539874077 Jun 24  2014 Sports preview 14-4-60.mov
-rwxrwxrwx. 1 root root  9367284750 Jun 24  2014 Sports preview 3-3-60 Boat Race.mov
-rwxrwxrwx. 1 root root 12825530544 Jun 24  2014 S.Preview 24-3-60.mov
??????????? ? ?    ?              ?            ? S.Preview 24""3"60.xml
-rwxrwxrwx. 1 root root       15449 Jun 24  2014 S.Preview 3-3-60 Boat rACE.xml
-rwxrwxrwx. 1 root root       12682 Jun 24  2014 S. Preview Junior Rugby.xml
-rwxrwxrwx. 1 root root 15348985946 Jun 24  2014 S.Preview March.mov

Let me know if you have any questions or suggestions you want me to try.

Smock

Posted 2019-04-16T13:14:26.803

Reputation: 359

I don't think the name is the problem. I was able to create a file with the same name by wrapping it in single quotes. But all those question marks suggest there's a problem with the directory. Can you umount it and run fsck on it? – Ken Jackson – 2019-04-16T13:50:35.477

Have you tried just single quotes? cp 'Item from 23"2"60 with special chars.xml' /tmp/x.xml – Ken Jackson – 2019-04-16T13:53:04.207

Single quotes don't seem to work - see edited extra info – Smock – 2019-04-16T14:04:33.527

As it's a filesystem that exists on a qstar tape system, I don't think I can fsck it. I can 'umountiv' and 'mountiv' but don't think I can do much else with it (or lack the expertise to do it confidently without destroying stuff). So you think the files might be corrupt or something? – Smock – 2019-04-16T14:06:12.827

From man 2 stat: "execute (search) permission is required on all of the directories in pathname that lead to the file." I've never worked with tape. Can you mount it readable and run chmod +x on each directory? Or is there a special mount option for tapes? – Ken Jackson – 2019-04-16T14:18:53.677

The question marks in the ls output hint that you have problems accessing the parent directory (bad ACLs?) – xenoid – 2019-04-16T14:44:20.133

@KenJackson I think there's a catalogue kept somewhere (in the qstar software) that knows what file is on which tape. You mount a set of tapes to access the actual files, but you don't need every tape in all the time. If you try to access a file that on a tape not in the library, the qstar software tells you to insert it, and then it scans the tape and carries out the file access – Smock – 2019-04-16T14:46:16.270

parent directory is 777 root:root - i am logged in as root – Smock – 2019-04-16T14:49:28.220

I am wondering if it's not the " character, but some other character that my bash session is rendering as " (I seem to remember something before when : colons rendered as _ underscores) – Smock – 2019-04-16T14:54:10.437

No answers