Pergunta

I have a remote Linode, which I am using Cygwin to access. An errant database file, specifically "C:\Users\Blah\Blah\website\blah\sqlite.db" was created. This file was used for local testing on my Windows machine, but was generated due to a mistake on the Linode. Note, this is the full file name inside the Linode, not the location of it. This is Windows syntax, not Unix, which is where I think the problem lies.

Now, I cannot delete it! It says, cannot remove file "file name" where file name does not have any of the original backslashes. This tells me that it cannot recognize that this is an errant windows DB file.

How can I delete this? If I had access to a GUI folder I could use that, but I only have the command line!

Please help!

Nenhuma solução correta

Outras dicas

The backslash and colon are not special characters to the filesystem (which is why you can have a file with those characters in its name), but backslash is a special character to the shell (and : is special in some contexts).

You just have to pass the file's name to the rm command. To do this from the shell, you need to escape the backslash characters.

This should work:

rm C:\\Users\\Blah\\Blah\\website\\blahsqlite.db

For example (I just tried this on my own system):

$ touch C:\\Users\\Blah\\Blah\\website\\blahsqlite.db
$ ls
C:\Users\Blah\Blah\website\blahsqlite.db
$ rm C:\\Users\\Blah\\Blah\\website\\blahsqlite.db
$

And if your shell supports tab completion, then you can probably just type rm Ctab and, if there are no other files in the current directory whose names start with C, the shell will expand that to (an escaped version of) the file name. (Bash happens to insert a a \ in front of the : as well; this is unnecessary but harmless.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top