Jan 18 2008

How to get past the 250 character limit on Windows file copying

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

Google Query: cannot remove folder filename or extension too long

I was copying some files from an older file server to a newer file server when I ran across the above error. After some Googling, I was reminded of a Windows “feature” that I have not had to deal with before. Apparently there is a 250 character limit on the Windows file path when copying files to a different location. This is not a limitation of NTFS, but a “feature” of Windows explorer shell.

Anyway, it is something that you just have to deal with. There are a few approaches that you could take.

-Delete all the user’s files and smack them for using such long filenames and burying their files “20,000 folders under the C:” .

*Note the above method will probably get you fired (would it be worth it though?)

-Find some way to shorten the file path so you can copy it over.

It just so happens that the above method can be achieved without a loss of employment using the Windows SUBST command to create a virtual drive that is mapped to a folder on your Windows machine.

-Open up the command prompt by going to “Start->Run” and typing “cmd”

-In the command prompt window type the following:
subst v: "c:\path\to\your\ridiculous\unnecessarily\buried\folder\under\a\folder\under\a\folder"

Now instead of trying to copy “c:\path\to\your\ridiculous\unnecessarily\buried\folder\under\a\folder\under\a\folder\file.txt”

You will be copying “v:\file.txt”

When you are done with the virtual drive you can unmap it by typing the following at the command prompt:
subst v: /d

That’s it! If you are a user reading this, please try to use more sensible file organization techniques. If you are an IT professional, congratulations for not strangling your users. Happy File Copying!

Technorati Tags: , , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

TAGS:

5 Comments on this post

1. Wray said:

C:\now\who\would\do\some\thing\like\that\?

Can’t be done with either:
1) not logged in due to forgotten pw
2) the ESC key continually pressed

January 18th, 2008 at 7:43 pm

Awesome trick.. thanks hstagner

December 17th, 2009 at 7:33 pm
3. Irfan said:

thanks
it saved my lots time

April 8th, 2011 at 1:57 am
4. aba said:

An easier way that worked for me was to rename the folders above with shorter names until the total path was short enough. Then delete the file(s) normally.

August 23rd, 2011 at 4:09 pm
5. Mike said:

OMG You are a life saver man.

November 6th, 2011 at 6:16 pm
Subscribe Form