-1

I'm having trouble accessing certain Files in java. Altough the files get loaded of the Filesystem using folder.listFiles() etc...

The problem I have is that some files have special characters and spaces.

Example:

     /test folder/subtestfolder/>> my file.txt

I think java translates it to:

     '/test folder/subtestfolder/?? my file.txt'

To pass it to CentOs. But because there are spaces and special characters theres no analyzing on the ??. Is it possible to force to use the >> or encode it?

This is the error I get from a library I use:

java.io.FileNotFoundException: /test folder/subtestfolder/?? my file.txt(No such file or directory)
    at java.io.FileInputStream.open(Native Method)...
DavidVdd
  • 1,020
  • 3
  • 17
  • 40

1 Answers1

1

Escape them using \

like /test folder/subtestfolder/\>\> my file.txt

TheWhiteRabbit
  • 15,480
  • 4
  • 33
  • 57
  • Hi, I haven't tested you're solution but the other one works for each file and doesn't require escaping! – DavidVdd Feb 08 '13 at 09:22