Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

After installing Cygwin on Windows 7 and realising I'm better of with using Linux on a different partition, I wanted to uninstall it. However, Cygwin has no uninstaller so I was left with the option of deleting the whole folder it was installed in - which I did.

The problem is that a single file remained, in the whole directory tree, named README. - C:\cygwin\usr\share\texmf-dist\doc\latex\hausarbeit-jura\README.

I know Windows isn't supposed to allow files with names ending in ., but this one obviously got through, and I cannot delete it. When trying to do that, I get an "Item Not Found" - This is no longer located in C:\cygwin\usr\share\texmf-dist\doc\latex\hausarbeit-jura. Verify the item's location and try again.

Any ideas on how to get rid of it ?

Some extra info that might help:

When viewing the properties of the file (Right-click, Properties), Windows tells me that it has 0 bytes.
However, when viewing it in the explorer window, and clicking on it, the windows status bar thing tells me it has 517 bytes.

share|improve this question

migrated from stackoverflow.com Oct 28 '12 at 21:19

This question came from our site for professional and enthusiast programmers.

    
This is a shot in the dark, as I'm not sure what steps you've taken, but have you tried deleting it from the cli? –  paperids Oct 26 '12 at 18:04
    
Yes, I do get the exact same error. –  user241543903 Oct 26 '12 at 18:15
    
You can write a short program to unlink specifically that file. That WILL work. –  OmnipotentEntity Oct 26 '12 at 18:39

4 Answers 4

up vote 3 down vote accepted

Here's a short VBScript file to do what you need.

Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile("C:\cygwin\usr\share\texmf-dist\doc\latex\hausarbeit-jura\README.")

This should bypass the issue you're having with the del command and windows explorer. Just save that text as whatever.vbs and double click it.

If the file is flagged as read-only then you'll need to add a bit to that code, let me know.

share|improve this answer
2  
I managed to delete the file in cli using DEL *.* (DEL README. wouldn't work). However the folder still couldn't be deleted. Your script, adjusted for folders, did the trick. Cheers! –  user241543903 Oct 26 '12 at 19:10

Open an elevated command prompt and type in the following commands, pressing Enter after each one:

cd C:\cygwin\usr\share\texmf-dist\doc\latex\hausarbeit-jura\

del *.*

Y

cd c:\

rmdir /s /q C:\cygwin\usr\share\texmf-dist\doc\latex\hausarbeit-jura\

rmdir /s /q C:\cygwin\usr\share\texmf-dist\doc\latex\

rmdir /s /q C:\cygwin\usr\share\texmf-dist\doc\

rmdir /s /q C:\cygwin\usr\share\texmf-dist\

rmdir /s /q C:\cygwin\usr\share\

rmdir /s /q C:\cygwin\usr\

rmdir /s /q C:\cygwin\
share|improve this answer

The easiest way to do this is to open a Windows Command Prompt window and use the rd command with the /S /Q options. You might have to open the Command Prompt as an administrator for this to work.

  1. Click the Start Button (Orb) and locate the link to open the Command Prompt. If you don't see it, you might have to search for it by typing command or cmd.exe in the search box at the bottom.
  2. Right click on the command or cmd.exe link and select Run as administrator, then click Yes if prompted to allow it.
  3. In the Command Prompt window, type the command (don't press the Enter key yet):
    rd /S /Q "C:\Cygwin"
  4. This command will delete all the files and folders inside the specified folder without prompting, so be sure to double and triple check check that you have specified the correct folder.
  5. If you want to be prompted to delete the files and sub-folders, type the command without the /Q like this: rd /S "C:\Cygwin"
  6. When you are sure you have typed the command correctly, press the Enter key.

The Cygwin folder, and all the files and sub-folders within it will be deleted.

Here is the syntax for the rd command:

C:\>rd /?
Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

    /S      Removes all directories and files in the specified directory
            in addition to the directory itself.  Used to remove a directory
            tree.

    /Q      Quiet mode, do not ask if ok to remove a directory tree with /S


If there are System, Hidden, or Read-only files or folders that cause the rd command to fail, use the attrib command with the /S /D options like this:

attrib -S -H -R "C:\Cygwin\*.*" /S

to remove those attributes from the files and sub-folders, then re-try the rd command.

share|improve this answer

Having tried all of these suggestions and more, I still couldn't delete the offending files.

What finally did it was to use the following syntax (in an elevated command prompt):

del "\\?\<full path to file>"

eg, to use the original example:

del "\\?\C:\cygwin\usr\share\texmf-dist\doc\latex\hausarbeit-jura."
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.