malformed file name on disk to be deleted

0

In my desktop folder I do have a directory called 'final_year_project_cd'. Inside that directory I do have this file with following file name.

final_year_project_cd/src/customers_view_window.h\n\n;\n’:

This is due to I'm editing files on this directory from both linux and windows machines. But I don't know why linux kernel/file system driver does allow there to name a file like this at the first place[well that's beyond my skills and capabilities to explain why or how].

The problem is , now I need to clean-up this directory from my desktop and so far I have tried following things but no success yet !

  1. tried with 7-zip file manager.
  2. Tried with cygwin terminal.
  3. Tried with command line. "rmdir /s /q"

I still didn't tried to delete this under linux. May be that would work. Any new idea to try to delete this file under windows ?

UPDATE:

  1. Have used the mv command as suggested by @Ohnana too.

Still not working.

Sandun Dhammika Perera

Posted 2015-01-13T16:44:59.013

Reputation: 103

1Have you attempted a mv command to change the filename? – Ohnana – 2015-01-13T19:07:57.667

I tried mv command to change the file name but it didn't worked – Sandun Dhammika Perera – 2015-01-13T19:12:05.003

Answers

1

The slashes in the filename pose a particular problem in Unix, but https://kb.iu.edu/d/abao suggests some different ways of deleting such files. The ultimate answer suggested was to FTP into the directory from another account (with sufficient privileges, of course) and use mdel to delete all files with prompting. You might also use Midnight Commander, https://www.midnight-commander.org/.

DrMoishe Pippik

Posted 2015-01-13T16:44:59.013

Reputation: 13 291

Solution regarding midnight commander does not working. It returns the error 19 , the resource is busy. Any idea what is error 19 is? And directory was not open in any other file manager or a process. – Sandun Dhammika Perera – 2015-01-13T19:20:44.620

Do a complete shutdown, then open MC before any other application; hopefully, the file will be unlocked. If not, boot from USB or DVD; that should eliminate any file use issue. – DrMoishe Pippik – 2015-01-13T21:17:49.570

1

Two things to try using the cygwin terminal's version of rm:

1) rm "final_year_project_cd/src/customers_view_window.h\n\n;\n’:"

2) rm final_year_project_cd/src/customers_view_window.h*

You can also attempt to use the windows command line:

DEL final_year_project_cd/src/customers_view_window.h*

Luckily, those are back slashes in your filename, so if all else fails you can delete it on Linux using the ultra-delete procedure:

user@host $ ls -i
####### final_year_project_cd/src/customers_view_window.h\n\n;\n’:
user@host $ find . -inum ##### -exec rm {} \;

What this does is you request the inode number from ls. I've marked it as ###### above. Then, you point the find command at it via the inode number and tell it to delete the bugger.

Ohnana

Posted 2015-01-13T16:44:59.013

Reputation: 671