42

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

espinchi
  • 551

17 Answers17

30

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

EBGreen
  • 9,655
9

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

johnshen64
  • 4,701
9

How about running CHKDSK?

There was a similar question here: How to force Windows 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.

Anton
  • 205
4

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()}
Lucas
  • 49
4

Could you try renaming it?

rename *.zip tmp.zip
3

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

BobT
  • 481
3

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

oleschri
  • 1,215
2

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

2

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

Marcx
  • 727
2

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"
inevio
  • 281
2

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

rezx
  • 185
1

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

PhilJ
  • 129
0

Try these small but powerful utilities: lockhunter or unlocker.

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
0

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.

npclaudiu
  • 656
0

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

0

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.

Dennis C
  • 451
0

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.

Frank R
  • 306