Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Can't delete file due to invalid file name

16 Jun 2012   #1

Windows 7 Ultimate 64-bit
 
 
Can't delete file due to invalid file name

Hey all!

I have a .png file on my secondary hard drive, which I cannot seem to delete. When I try to delete or rename it, it tells me: "The selected file name is invalid or too long".

I came across the programs Delinvfile and Unlocker, but they did not seem to work for me.

Appreciate any help!

My System SpecsSystem Spec
.

16 Jun 2012   #2

Windows 8 Core X64
 
 

Try this: Open an Elevated Command Prompt. Change to the directory (folder) the file is in. You do this using the cd command.
For instance, if the file is in your Pictures folder, you would enter:

cd C:\Users\xxxxxxxx\Pictures (xxxxxxxx is your account name)

Once in the right directory (folder), use the del command as follows to see if you can delete it. If, for instance, the file starts with asdfg0000....... etc,

del asdfg000*

That will delete any file that begins with the letters adsfg000, so be careful. Make sure you use enough of the beginning letters so the del command will only delete that file.
My System SpecsSystem Spec
16 Jun 2012   #3

Windows 7 32 bit
 
 

Quote   Quote: Originally Posted by RobinSchouten View Post
Hey all!

I have a .png file on my secondary hard drive, which I cannot seem to delete. When I try to delete or rename it, it tells me: "The selected file name is invalid or too long".

I came across the programs Delinvfile and Unlocker, but they did not seem to work for me.

Appreciate any help!
If you find a bunch of files don't want to delete in Explorer try scanning with Malwarebytes anti-malware. I had a registry hack that added NoModify to all files in Explorer. Malwarebytes got rid of it easily.

But it is quite possible to get filenames longer than Explorer can handle. In those cases use command line deletion.

Also if you search online there's a tool called TLPD.exe that searches for files with paths too long.
My System SpecsSystem Spec
.


17 Jun 2012   #4

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by Ztruker View Post
Try this: Open an Elevated Command Prompt. Change to the directory (folder) the file is in. You do this using the cd command.
For instance, if the file is in your Pictures folder, you would enter:

cd C:\Users\xxxxxxxx\Pictures (xxxxxxxx is your account name)

Once in the right directory (folder), use the del command as follows to see if you can delete it. If, for instance, the file starts with asdfg0000....... etc,

del asdfg000*

That will delete any file that begins with the letters adsfg000, so be careful. Make sure you use enough of the beginning letters so the del command will only delete that file.
Thanks, but I can't seem to cd to D:/...

How come?
My System SpecsSystem Spec
17 Jun 2012   #5

Windows 8.1 Pro RTM x64
 
 

You need to enter the /D switch in the command. This allows you to change the current drive in addition to the current directory. So the command after the prompt reads as follows (note that the switch needs to be entered as shown): cd /d d:\ This works from both an administrative and user command prompt, but remember that the context and scope of any subsequent commands that you perform on the drive/directory is still the same as that to which you executed CMD in the first place.
My System SpecsSystem Spec
17 Jun 2012   #6

Windows 7 Ultimate 64-bit
 
 

Ok, so I followed all your instructions, but it still does not work. I get a similar error: "The filename, directory name, or volume label syntax is incorrect".
My System SpecsSystem Spec
17 Jun 2012   #7

Windows 8 Core X64
 
 

Can you post the name of the file?
My System SpecsSystem Spec
17 Jun 2012   #8

Windows 7 32 bit
 
 

Quote   Quote: Originally Posted by RobinSchouten View Post
Ok, so I followed all your instructions, but it still does not work. I get a similar error: "The filename, directory name, or volume label syntax is incorrect".
Peculiar since when I google asdfg000 I get a bunch of references to online games, profiles and blogs. How about posting a screen shot of the folder showing the file or whatever it is, in the screen shot? Something is weird.
My System SpecsSystem Spec
17 Jun 2012   #9

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by MilesAhead View Post
Quote   Quote: Originally Posted by RobinSchouten View Post
Ok, so I followed all your instructions, but it still does not work. I get a similar error: "The filename, directory name, or volume label syntax is incorrect".
Peculiar since when I google asdfg000 I get a bunch of references to online games, profiles and blogs. How about posting a screen shot of the folder showing the file or whatever it is, in the screen shot? Something is weird.
That was a file name example given by Ztruker.

The file it's about is a .png desktop screenshot taken when I was dualbooting with Ubuntu. When I got rid of it, I copied all the files I wanted to keep to my secondary hard drive including this desktop screenshot. The other files act normally, but this one is not.

The file name is: "Schermafdruk_van_(time)_(date).png". Without the quotes and with the correct variables.
My System SpecsSystem Spec
17 Jun 2012   #10

MS Windows 7 Ultimate SP1 64-bit
 
 

Robin,
Is this file in the Pictures folder?
You have given the name but not the path for the file.

Try following:
go to an elevated command prompt and enter following commands:
CD /D %userprofile%\Pictures
dir schmerafdruk*.*
does you trouble file show up?

Go To an Elevated Command Prompt


Elevated command prompt = Run CMD.EXE as administrator
WIN | type CMD.EXE | do not hit Enter |
CTRL+SHIFT+ENTER keycombo| YES

WIN is the key with the Microsoft flag on top.
My System SpecsSystem Spec
Reply

 Can't delete file due to invalid file name




Thread Tools



Similar help and support threads for2: Can't delete file due to invalid file name
Thread Forum
Windows 7 USB/DVD Download Tool Invalid ISO file Installation & Setup
Solved Unable to delete a file,can't delete it can't shred it, General Discussion
Solved Help file wont delete win 7 says there is no file General Discussion
Invalid File System (Epson P-7000 photo viewer) Hardware & Devices
File too long or invalid error. General Discussion
Solved Invalid BOOT.INI file Installation & Setup
Invalid boot.ini file BSOD Help and Support

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:38 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33