0

I was using pscp to copy files from a Windows machine to a Linux machine. I accidentally got the path wrong and now there are files that I can't seem to remove. I think it is because of the slashes in the name... It is telling me the file or directory doesn't exist. I am attaching a photo. Thanks!

enter image description here

3 Answers3

1

In the UNIX shell, backslashes need to be escaped or single quoted. You can remove those files with one of the following:

rm '\home\sluddani\installApps'

OR

rm \\home\\sluddani\\installApps

Peschke
  • 4,148
0

You can use the "-i" (interactive) option of /bin/rm. Of course, you need to be very careful. In this particular case I would do this:

cd && /bin/rm -i *Apps*

It is possible that "Apps" will not match anything, and in that case (being VERY careful):

cd && /bin/rm -i *

This is typically the best way to delete files that have hidden characters or are otherwise difficult to name explicitly on the command line. If matching the backslash character works with matching backslashes, it is a better solution than this one.

In both cases you will be prompted to confirm deletion- make sure you don't answer yes to files you want to keep.

0

If there is a chance there is a file manager in that host you can launch it from the terminal and remove the file there.

This will run nautilus in the current directory:

nautilus .

This will save you from unintentionally remove the wrong file, or worse.

Francesc Guasch
  • 383
  • 1
  • 3
  • 11