• Skip to content
  • Skip to footer

Jody Hatton

Video Marketing That Gets Results

Main navigation

  • Home
  • About
  • Portfolio
  • Blog
  • Fun
    • Animation Experiments
    • Music Experiments
  • Contact

How to Delete or Rename a Folder with an Invalid File Name in Windows 7, Vista, XP, etc.

The Short Version:

  1. Open a command-prompt window (click the “Start” button then type “cmd”)
  2. Navigate to the folder that contains the offending folder (type “cd temp\foldername\whatever”)
  3. Rename the file or folder using the Win95/DOS long-file name; let’s pretend it’s called “invalidfilename ” (ren invali~1 goodname)
  4. Delete the folder (rd goodname)

The RIVETING Full Story:

One of my clients recently sent me a ZIP file with a bunch of songs he wanted to put on his website. When I extracted it, it created a folder that couldn’t be read or deleted.

(See, the Windows file system doesn’t allow question marks, slashes, quotes or spaces-at-the-end-of-folder-names whereas other operating systems do.)

In order to correct this issue, I called upon my brain to remember a few things from the Windows 95 days.

If you were a nerd back then, you might recall being super-excited that Windows finally began allowing long file names. What a marvel! What progress!

You might also recall that when you went into DOS, all your lovely file names — such as “omg this is a long file name” or “this is really amazing” — were butchered into “omgthi~1” and  “thisis~1”

It made browsing and file-copying a serious hassle. 17 years later, I STILL have files on my drive with these pooched names…

Anyway, in order to delete a folder with an invalid name, you’ll need to do a little old-school hacking.

Here’s how:

  1. Open a command-prompt window (click the “Start” button then type “cmd”)
  2. Navigate to the folder that contains the offending folder (type “cd temp\foldername\whatever”)
  3. Rename the file or folder using the Win95/DOS long-file name; let’s pretend it’s called “invalidfilename ” (ren invali~1 goodname)
  4. Delete the folder (rd goodname)

HOORAY!

Don’t miss this post:

Free gift! Learn EXACTLY how to market your business in 2017

Click here to get access

Reader Interactions

Comments

  1. Arash says

    April 20, 2013 at 3:41 am

    Hehehehee 😀
    Nice
    Thanks 😉

    Reply
  2. jaywon51 says

    February 12, 2014 at 12:42 am

    Well, Long path tool can help on this situation. Thanks

    Reply
  3. Ram Lalit says

    May 23, 2014 at 11:19 am

    It can be deleted in linux OS,if you have access to.

    Reply
  4. Tom says

    October 5, 2014 at 8:59 pm

    LongPathTool is payware, unfortunately. Not paying for something I only need once every 2 years.

    Reply
  5. MSF says

    November 16, 2014 at 11:00 am

    Great Help!!! Thank you!! Always wonder how Mr. Softy survives and thrives peddling such damaged goods…

    Reply
  6. Janak Nepal says

    February 3, 2015 at 7:34 pm

    If you need to delete files with invalid file names, all you need to do is:
    1. Open the Command prompt.
    2. Type this command: chkdsk drive: /f /x
    e.g. c:chkdsk e: /f /x
    It will delete the files with invalid file names…

    Reply
    • XDude says

      February 4, 2015 at 8:11 am

      I always get a little nervous whenever I bring out the auto-fixing, non-confirming chkdsk… sometimes it gets a little delete-happy. But yes, it would work. 🙂

      Reply
    • Lloyd says

      February 24, 2015 at 9:00 am

      Old school still works! Nice job

      Reply
    • Sina Ahmadpour says

      March 31, 2017 at 2:29 pm

      You Are A Life Saver
      You Are A Hero

      I Love YOU!

      Reply
    • justme says

      August 1, 2017 at 9:30 pm

      A really good solution. The probelm was a filename such as ‘afilename.*pg’

      Reply
  7. Andrew says

    December 24, 2015 at 6:14 pm

    This won’t work for me. I keep on getting “the system cannot find the path specified”. Is there some option I need to enable first in order for this to work?

    Reply
  8. Nova says

    October 28, 2016 at 3:19 am

    how do i navigate to the folder (2nd step)

    Reply
    • XDude says

      November 1, 2016 at 7:12 am

      Thanks for the feedback, I’ve updated my article accordingly. 🙂

      You’ll need to type “cd tempfoldernamewhatever”

      Experience from the old DOS days will definitely help, if you have it. 🙂

      Reply
  9. debruces says

    January 1, 2017 at 8:23 pm

    Hi Xdude,

    With your solution it helps to know the DOS (8.3) name of the offending folder with:

    <<>>

    And you save yourself the renaming step at the same time, in short:

    ——————————-

    Here’s how:

    1- Open a command-prompt window (click the “Start” button then type “cmd”)
    2- Navigate to the folder that contains the offending folder (type “cd tempfoldernamewhatever”)
    3- Type “dir /x” to locate the DOS 8.3 short file name of the folder you want to poof; let’s pretend it’s called “Invalid Folder Version 7.0.1880 (x64)” and dir /x shows its short name to be “invali~1.188”
    4- Delete the folder (rd invali~1.188)

    —————————

    I had this exact problem and a google search brought me to your place, problem was neither chkdsk nor your initial solution helped cause I was unable to ascertain what 8.3 filename the damn folder got, remembered from some time ago to look for the “dir” switch to show 8.3 filenames with a “help dir” and the rest is History. 🙂

    This way, no matter what, you’ll be able to delete it (Windows 7 64bits).

    Take care

    Reply

Trackbacks

  1. How To Fix Directory Name Is Invalid Accessing File Errors - Windows Vista, Windows 7 & 8 says:
    October 24, 2014 at 4:06 pm

    […] How to Delete or Rename a Folder with an Invalid File Name … – The RIVETING Full Story: One of my clients recently sent me a ZIP file with a bunch of songs he wanted to put on his website. When I extracted it, it created a folder …… […]

    Reply

Leave a Reply to How To Fix Directory Name Is Invalid Accessing File Errors - Windows Vista, Windows 7 & 8 Cancel reply

Footer

Contact

Email: info@jodyhatton.com
Phone: by appointment

About

I help companies make more money with smart video marketing strategies. Over 18 years of experience in animation and video production.

Originally from Canada. Current home base: Erfurt, Germany. Visited 20 countries in the last 4 years. [Learn More]

Get Social

  • Email
  • Linkedin
  • RSS
  • Vimeo
  • YouTube

Copyright © 2018 Jody Hatton.

  • Home
  • About
  • Portfolio
  • Blog
  • Fun
  • Contact