46

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?

5
  • 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?
    – Sturm
    Commented Oct 26, 2012 at 18:04
  • Yes, I do get the exact same error.
    – user241543903
    Commented Oct 26, 2012 at 18:15
  • You can write a short program to unlink specifically that file. That WILL work. Commented Oct 26, 2012 at 18:39
  • 1
    dupliciate: How to delete a folder that name ended with a dot(���.”)
    – phuclv
    Commented Mar 31, 2017 at 15:45
  • 1
    Why not simply use wildcards: del README*? Commented Jun 15, 2017 at 13:02

8 Answers 8

76

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."
6
  • I did this when the vbs script solution in the accepted answer did not work. The file is gone now :]
    – FRob
    Commented Jun 25, 2015 at 10:01
  • 1
    This works! Really awesome! Commented May 29, 2017 at 20:56
  • 2
    This works with del but doesn't work with some other cmd builtins like move and rename. Commented Aug 30, 2018 at 13:24
  • 1
    Its 2019 and I can confirm this works - and seems to be the easiest solution to do. Unclear if it matters, but I ran it from a CMD started in administrator mode. Thanks @micha
    – Paul T.
    Commented Feb 16, 2019 at 16:08
  • 1
    @ivan_pozdeev 7zip-FM (7zip file manager) worked for me to rename dot-ended file on Win10 x64. Quick and painless. This idea found by way of superuser.com/questions/1322618/… Commented Apr 11, 2019 at 18:14
20

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

10
  • 2
    Great trick. The only thing that worked for me
    – Cynapse
    Commented Mar 20, 2016 at 18:45
  • 4
    7zip works fine. Thx :-). Commented Nov 6, 2016 at 10:14
  • 1
    I really like it, because in my experience broken files are often result of using WinRar
    – user502144
    Commented Nov 11, 2016 at 18:39
  • 2
    7-zip worked for me
    – HackSlash
    Commented Sep 19, 2017 at 15:38
  • 1
    Upvoted. Lovely example of thinking out of the box :)
    – red-o-alf
    Commented Jan 26, 2019 at 19:08
6

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\
1
  • 3
    I guess del *.* would have sufficed as an aswer... Commented Sep 22, 2017 at 14:26
5

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.

2

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.

1
  • 6
    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
    Commented Oct 26, 2012 at 19:10
2

Use bash rm command from Ubuntu on Windows 10

1

The way I did it was pretty easy. I have a dual-boot system with Linux, so I just booted into Linux, navigated to the file and deleted it. I'm sure you could do the same with a live CD.

1

I had an image that has no extension by the name cropped_image_new1597487825.

Just open the elevated Command Prompt,

Type dir /x to obtain the 8.3 formatted filenames.

Delete the file using the 8.3 filenames, e.g. 'del CROPPE~2'

Here is a working example:

C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic>del cropped_image_new1597487825.
Could Not Find C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic\cropped_image_new1597487825.

C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic>dir /x
 Volume in drive C is Windows 7
 Volume Serial Number is 6616-BD66

 Directory of C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic

05-11-2018  12:09    <DIR>                       .
05-11-2018  12:09    <DIR>                       ..
05-11-2018  12:06                 0 CROPPE~2     cropped_image_new1597487825.
               1 File(s)              0 bytes
               2 Dir(s)   6,169,853,952 bytes free


C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic>del CROPPE~2

C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic>dir /x
 Volume in drive C is Windows 7
 Volume Serial Number is 6616-BD66

 Directory of C:\Users\Acer\Desktop\proj_ci\uploads\profile_pic

31-01-2019  14:58    <DIR>                       .
31-01-2019  14:58    <DIR>                       ..
               0 File(s)              0 bytes
               2 Dir(s)   6,169,702,400 bytes free

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .