1

I need to open a file with filename that contains forward slashes. I am wondering how I can do that. I have been searching through Google and I can't seem to find a way.

Thanks

5

2 Answers 2

1

Turning my comment into a bit of a possibly useful answer. Try renaming the file.

ls -i

Will give you the inode number of the file. You can then use a combination of find and mv to rename the file as follows:

find . -inum "inode-number-from-ls -i" -exec mv {} "newfilename" \;

Give the file a "normal" new file name and you're good to go.

3
  • Good one! Should work.
    – fedorqui
    Jun 5, 2013 at 8:03
  • 1
    Why on Earth is this going to work? If find can pass a valid name to mv, then it's not a problem for a user to do the same. Apr 18, 2017 at 22:55
  • Because the name that find passes will be correctly encoded, unlike what the user would type on the terminal.
    – SBI
    Apr 19, 2017 at 8:24
-1

It must be a Windows file. You have several ways to solve this:

  • Wrap the name with quotes: vi "file/name".
  • Use tab to complete the name. It will give you the proper way to write it.
  • Find a pattern and use *. If the name of the file is file/name, you can do vi fil* and this will be opened (together with others that can have same pattern).
6
  • The filesystem calls will interpret / as the directory separator regardless of how it's specified on the command line. Jun 4, 2013 at 22:35
  • 1
    Yes, I see. Nevertheless, the fabulous tab can provide a way to escape it, doesn't it?
    – fedorqui
    Jun 4, 2013 at 22:37
  • 1
    I tried all three methods unfortunately none worked. I am wondering if I can somehow rename the entire file on a program using java or something that isn't as aware of the encoding.
    – Gnator
    Jun 4, 2013 at 23:11
  • What about mv file* newname?
    – fedorqui
    Jun 4, 2013 at 23:15
  • Unfortunately it didn't work also. I suspect moving the file around corrupts the file because it is a zip file originally.
    – Gnator
    Jun 4, 2013 at 23:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .