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.

Possible Duplicate:
How to force Windows XP to rename a file with a special character?
how to delete (invalid) files with colon in their name under windows

I want to delete a file named workspaces\google-gson-1.7.1-release.zip Yep, it contains a backslash in the name.

Here it is:

G:\>dir Z_DRIVE
 Volume in drive G is samsung
 Volume Serial Number is 48B9-7E1D

 Directory of G:\Z_DRIVE

04/06/2012  08:09 PM    <DIR>          .
04/06/2012  08:09 PM    <DIR>          ..
05/01/2011  02:21 PM           528,016 workspaces\google-gson-1.7.1-release.zip
           1 File(s)        528,016 bytes
           2 Dir(s)  88,400,478,208 bytes free

The first attempt is to just delete it from the Windows Explorer, but it says it can't find the file.

Then, I tried from the command line:

G:\>del Z_DRIVE\workspaces\google-gson-1.7.1-release.zip
The system cannot find the file specified.

And, after researching a bit in the internets, I also tried the following, with no luck:

G:\>del \\?\G:\Z_DRIVE\workspaces\google-gson-1.7.1-release.zip
The system cannot find the file specified.

Other than booting from some Linux CD, is there a way to get rid of this file?

Update on 6 April 2012: also tried the following combinations, but the error is the same:

G:\>del "\\?\G:\Z_DRIVE\workspaces\google-gson-1.7.1-release.zip"
G:\Z_DRIVE>del workspaces\google-gson-1.7.1-release.zip
G:\Z_DRIVE>del "workspaces\google-gson-1.7.1-release.zip"
G:\Z_DRIVE>del workspaces*google-gson-1.7.1-release.zip

Update on 7 April 2012: Before I go ahead and try from Linux, here's an screenshot that shows some of the attempts based on the answers here. I'm not sure this will be easy to reproduce, and removing the friggin' file from Linux or using Cygwin feels like cheating :)

Some of the removal attempts

share|improve this question

marked as duplicate by Moab, Nifle, Ƭᴇcʜιᴇ007, Mehper C. Palavuzlar, random Apr 11 '12 at 1:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

13  
How did you get such a file? It's a good trick to annoy someone :-) –  nalply Apr 6 '12 at 22:11
1  
Delete the folder Z_DRIVE, make a new folder Z_DRIVE? –  Konerak Apr 7 '12 at 10:05

17 Answers 17

up vote 7 down vote accepted

How about running CHKDSK?

There was a similar question here: How to force Windows XP to rename a file with a special character?, one of the answers to which demonstrated that CHKDSK deletes files with invalid characters in their name.

share|improve this answer

did you try with powershell? if not, try :

First move to the folder, then start powershell (typing powershell, enter) then copy it:

ls | ?{$_.name -like "*\*"} | %{$_.delete()}
share|improve this answer

It looks like this drive is associated with Google Workspace or Google Online docs which creates a drive on your desktop. I would suggest finding the App that handles this and deleting the file or folder from the Google Docs interface or uninstalling it, although that might also get rid of other files on the drive folder, so be sure to back up your data first.

share|improve this answer

It sound stupid but you can try Java. I remember I have a few times hit some file like you. And they were created by Java, and removed by java.

Another way to workaround is try to move the folder. Move all the other file away and del the folder recursively, there is some tools to remove folder without iterate the files inside.

share|improve this answer

I would try using short 8.3 naming:

del worksp~1.zip

since that does not seem to work for this specific file, the next thing that I would try is to open a Powershell command prompt then do:

Get-ChildItem G:\Z_Drive\* | Where-Object{$_.Name -Like 'workspaces*'} | Remove-Item -WhatIf

Be sure to play around with the pattern so that you are only matching that one file (not sure if there are other files in there or not). Once you see that it would only try to delete the one file, remove the -WhatIf

share|improve this answer
1  
1  
dir /X shows shortnames with the directory listing. –  Rob Apr 6 '12 at 23:15
2  
That's a great suggestion, I was convinced it would work... but it does not! As @Rob has suggested, I've used dir /x to find out the short name but... the short name is the same as the long name. Can't believe it! –  espinchi Apr 7 '12 at 2:46
3  
You might be able to set the short name for the file manually: fsutil file setshortname G:\workspaces\google-gson-1.7.1-release.zip google.zip. See: technet.microsoft.com/en-us/library/cc788058%28v=ws.10%29.aspx –  Andrew Lambert Apr 7 '12 at 17:47

Since Z_DRIVE only contains one thing, just delete the directory and then recreate it.

share|improve this answer

to solve the files there is a working way, install linux-ubuntu or use it with live cd, then go and delete the file... this thing happen to me when i make files with "xxx" on fat drive when i try to open rename or delete it on windows never allow, hope this help

share|improve this answer

Believe it or not, the output of dir /x is _ workspaces\google-gson-1.7.1-release.zip_

Sorry, I think you're looking at the wrong column of the output. The "dir /x" command should display the alternative name for any files with more than 8 characters in the name. Can you display the output of this command in your question like you did for the "dir" command please?

C:\Windows>dir /x
Volume in drive C is OS
Volume Serial Number is 9080-5E4E

Directory of C:\Windows

01/01/2012  18:29    <DIR>                       .
01/01/2012  18:29    <DIR>                       ..
14/07/2009  06:32    <DIR>                       addins
14/07/2009  04:20    <DIR>          APPCOM~1     AppCompat
11/08/2011  18:12    <DIR>                       AppPatch

As you can see, the directory "AppCompat" is the only folder with more than 8 characters so has been given a short name. The 4th column displays the short name (if created).

share|improve this answer
3  
I didn't mean create and I have adjusted the answer. I'm not able to comment on the original question or other people's answers because I only have 1 rep so I have to create an answer to help the OP. I do believe it is a valid answer if the OP was missing the 4th column of the command's output and this helps to solve the problem. –  PhilJ Apr 7 '12 at 11:33

Install cygwin tools from http://cygwin.com

Then ...

rm filename

That should do the trick.

An installation guide is here: http://www.mobilefish.com/developer/cygwin/cygwin.html

share|improve this answer

Assuming that you are using the Android SDK, you can try to delete it from the Android Shell using the rm command. Here is an example, under the From the Recovery Screen section.

share|improve this answer

Could you try renaming it?

rename *.zip tmp.zip
share|improve this answer

These types of oddly name files, I believe can only be created and removed from script, application, etc. So, you could create a windows script with WSH and use it there MS reference has the perfect example.

// JScript.
Shell = new ActiveXObject("WScript.Shell");
FSO = new ActiveXObject("Scripting.FileSystemObject");
DesktopPath = Shell.SpecialFolders("Desktop");
FSO.DeleteFile(DesktopPath + "\\test.lnk")

' VBScript.
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
DesktopPath = Shell.SpecialFolders("Desktop")
FSO.DeleteFile DesktopPath & "\test.lnk"
share|improve this answer

Can you type the first part of the filename and do a tab autocomplete? This often formats the filename in whatever specific way the system requires (double slashes, triple quotes, etc.)

share|improve this answer

Try these small but powerful utilities: lockhunter or unlocker.

share|improve this answer

try:

del workspaces*google-gson-1.7.1-release.zip

* is a special char that means everything so using this command you will delete

workspaces\google-gson-1.7.1-release.zip
workspacesagoogle-gson-1.7.1-release.zip
workspacesaeiougoogle-gson-1.7.1-release.zip
and so on..

EDIT:

if possibile, move all the files and folder out from Z_DRIVE and then remove directly the directory... then create a new Z_DRIVE and move back the previously moved...

share|improve this answer

open a cmd, do dir/x and find the short name of the file, and delete that.

share|improve this answer

Try surrounding the file name in double quotes (").

share|improve this answer

protected by Community Apr 7 '12 at 11:47

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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