How to delete a file ending in a dot in Windows 7?

After installing Cygwin on Windows 7 and realizing 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. at 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

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.

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.

Any ideas on how to get rid of it?


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."

What a really simple solution that I've found. It's the simplest and fastest and easiest way to achieve this. I am now laughing at how simple it is.

  1. Install WinRAR
  2. Follow the Step by Step procedure from the pictures:
  3.  
    enter image description here
  4.  
    enter image description here
  5.  
    enter image description here
  6.  
    enter image description here

I don't know if you can do it with 7zip, but WinRAR has it and you don't have to buy it, just install the trial and then uninstall it (or probably portables out there but I don't think they are legit i.e. they are possibly cracked.)


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\

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.


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.