LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Directory name cause scp errors (http://www.linuxquestions.org/questions/linux-software-2/directory-name-cause-scp-errors-601671/)

Roosta21 11-22-2007 08:21 AM

Directory name cause scp errors
 
I have a user that has created a directory called newDirectory?ls -al?mkdir newDirectory

I was attempting to do a backup by scp'ing the files to another server.. but this directory caused an error... but even though ls will list the directory i can not, cd into it or rename it. The server just says No such file or directory..

how can a gain access to the file or rename it, is there another method?

chrism01 11-22-2007 10:17 PM

Try putting single quotes around it and renaming:

mv 'newDirectory?ls -al?mkdir newDirectory' sensiblename

You might need to escape the '?'s also

mv 'newDirectory\?ls -al\?mkdir newDirectory' sensiblename

also, beat user around head with manual... ;)

Roosta21 11-23-2007 04:13 AM

Thanks but it still does not seem to recognise the directory it just returns a No such file or directory. even with the \ before ?

The only thing i can thing of is rm -r hte whole directory an then replace the files, but i cant get into the directory to check to see if an files are in there..

Any other ideas?

colucix 11-23-2007 04:22 AM

Try to escape like this
Code:

cd newDirectory\\\?ls\ -al\\\?mkdir\ newDirectory/

matthewg42 11-23-2007 08:27 AM

The ? character might be some strange character which cannot be displayed correctly in your terminal, and the font/terminal emulator chooses ? to indicate this... To find out what is actually in the file name use the -b option to ls, which will print non-printable characters as their octal encodings.

Tinkster 11-23-2007 12:58 PM

Or just use the tab-expansion method ;} Chances are bash will
be working the quoting out for you.



Cheers,
Tink

Roosta21 11-23-2007 01:21 PM

The tab worked thanks very much! I cant believe i never tried it.. but thanks everyone for you help..

Ross

Tinkster 11-23-2007 01:30 PM

Sweet :}

Cheers,
Tink


All times are GMT -5. The time now is 11:40 PM.