Link to home
Start Free TrialLog in
Avatar of Russ Dillion
Russ DillionFlag 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
Avatar of Justin Owens
Justin Owens
Flag of United States of America image

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
Avatar of Hattrick96
Hattrick96
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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
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
Avatar of 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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Thank you.  I am glad we were able to quickly resolve your issue.

DrU
Hattrick96,

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

DrUltima
Windows Servers Topic Advisor