File name too long cannot copy

General Discussions
Post Reply
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

File name too long cannot copy

Post by Saman » Wed Jan 08, 2014 8:23 am

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

Code: Select all

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:

Code: Select all

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!
jaheen100
Corporal
Corporal
Posts: 9
Joined: Fri Jan 03, 2014 4:17 pm

Re: File name too long cannot copy

Post by jaheen100 » Thu Jan 09, 2014 3:52 pm

If long file name cannot copy then try to short it.
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: File name too long cannot copy

Post by Saman » Fri Jan 10, 2014 11:29 am

With long file name issue, windows doesn't allow us to rename, copy or do any other operation on it. This is where the trick comes to help.

BTW: Welcome to the forum!!!
Please add an introduction under Member Area, so we can get to know you better. Thanks!
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: File name too long cannot copy

Post by Neo » Wed Jan 22, 2014 6:29 pm

One of the easy methods to do this is to use a Linux live CD/DVD ;)
User avatar
zalmax1
Posts: 1
Joined: Sun Feb 16, 2014 4:32 pm

Re: File name too long cannot copy

Post by zalmax1 » Sun Feb 16, 2014 4:34 pm

Try Long Path Tool, it works good for such issues.
Post Reply

Return to “General Discussions”