Avatar of Russ Dillion
Russ Dillion
Flag for United States of America asked on

Cannot move files due to path length limit

Hello Experts,

I am in the process of moving the home directories for some users from one volume to another on the same server.  While moving one home directory earlier today, I ran into an issue where a number of files could not be moved due to the path length limit.  The directory path lengths on the two volumes are exactly the same (ie: D:\Home\jdoe\personal\data\plans\ and E:\Home\jdoe\personal\data\plans\).  When looking at the full path length for any of the given files, it does in fact exceed the 256 character limit.  I have two questions.  First, how could the files have been created in the original volume in the first place, if the path length is too long?  Second, what can I do to move these files to the same location in the new volume?  

All of the files are .pdf files.  When searching for information, I read one post indicating that the native application of the file might have an implact on this.  After reading that, I copied some of the files to a temporary location with a shorter path, opened one of them in Acrobat Reader, and then attempted to save it in the new location.  However, this approach failed.  I have also attempted to use robocopy to copy the files to the new location, but that fails as well.  The server is Windows 2008 Standard SP2.  

Again, I am befuddled as to how the files could have been put in the original location in the first place, given their excessive path lengths.  Any \ all ideas are greatly appreciated.

Thanks,

Russ
Windows Server 2008Storage

Avatar of undefined
Last Comment
Justin Owens

8/22/2022 - Mon
Justin Owens

You are not going to like this answer.  Hopefully, all your super long files are in the same location.  When I have faced this in the past, the quick and dirty answer is to rename the parent folder structure...  So, in your example above

D:\Home\jdoe\personal\data\plans\

becomes

D:\Home\jdoe\p\d\p\

Is that good?  No, not at all. Will it get your folder structure down to a point you can rename the offending files?  Normally, yes.

As for the "how it happened to begin with", there are a number of ways that can happen... Honestly, Windows can be rather stupid at times, and allow applications to create file names its directory structure will not support.  You are then stuck with an orphan file until you can get it down to a readable level.

Respectfully,

DrUltima
ASKER CERTIFIED SOLUTION
Hattrick96

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Russ Dillion

ASKER
Hi DrUltima, and thanks for your reply.  I have anticipated that I will probably have to rename files and folders to get under the limit to get these moved.  The user in this case is one of our VPs, and I know he will ask for some detail about how this happened.  I have not, yet, found any consistent explanation.  Do you have any specific links or examples of how this can happen?  Thanks again, Russ
Russ Dillion

ASKER
Hi Hattrick96, and thank you for your reply.  I forgot to mention in my original post that I had tried using xcopy as well, my apologies.  I have not yet tried mapping the drive a subfolder in the path.  I will give that a try and see if I can get anywhere, and post the results here.

Thanks again, Russ
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Seaton007

The drive mapping should work as it reduces the path length for the copy/move procedure.

P.S. I just wanted to confirm the method Hattrick96 mentioned. If it works for you, please give the points to Hattrick96.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Russ Dillion

ASKER
Hello everyone and thanks very much for your help with this.  Yes, the suggestion from Hattrick96 did allow me to successfully copy the files to the new location, and yes, I agree with DrUltima that this does nothing to aleviate the original problem.  I did perform a restore of a couple of the files from a backup of the orginal location, which succeeded, and I was quite pleased to see that.  Also, yes, the additional information from DrUltima does help with an explanation, and at this point I can approach the user and discuss the issue.  At this point I am planning on splitting the points equally between Hattrick96 and DrUltima.  I hope that is cool with everyone.  Thanks again very much!  Russ
Justin Owens

Thank you.  I am glad we were able to quickly resolve your issue.

DrU
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Justin Owens

Hattrick96,

Congratulations on your first accepted Solution on Experts-Exchange.  Keep up the great work!

DrUltima
Windows Servers Topic Advisor