Click here to Skip to main content
15,899,026 members
Articles / All Topics
Technical Blog

Really Windows? Path is too long?

Rate me:
Please Sign up or sign in to vote.
4.89/5 (3 votes)
30 Sep 2015CPOL1 min read 10.2K   1   11
While developing with node.js in Windows I occasionally run into the issue where I can't delete a node module because the module has redundant subfolders that exceed Windows path limit of 260 characters thus forcing me to traverse each subfolder only to rename them to some arbitrary one length

While developing with node.js in Windows I occasionally run into the issue where I can't delete a node module because the module has redundant subfolders that exceed Windows path limit of 260 characters thus forcing me to traverse each subfolder only to rename them to some arbitrary one length character.

After doing some research into this issue I have came to the conclusion that the problem isn't Windows, it's the modules author and what seems like their inherent lust for deep hierarchies.

Solution One

In order to delete the path, getting around the 260 character limit, we must use the following alternate file designation methodology:

  • Shift-right-click on the item to be deleted and select copy as path
  • Open a command prompt then type DEL then paste the name of the path you copied
  • Next, go to the beginning of the line, and modify the drive letter for the Windows path so that it reads like \\?\<driveletter>:\

    For example, if the path begins with C:\ modify so it reads as \\?\C:\
  • Windows will now delete the file or folder successfully

Solution Two

If you're not a command line warrior here's a solution for you! The guys over at BackupChain created a freeware GUI tool called DeleteLongPath that does exactly what is described in solution one provided your user account has the permissions to do so.

Wrap Up

If either one of these solutions helped you out leave a comment below! I'm curious as to how many people have ran into this problem.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
If you liked my post visit my website at http://ericanderson.io

I'm a software engineer, gamer and musician who loves all things .NET.
When I'm not spending time with my family I love learning new things about programming, talking about tech and teaching people how to code.

Currently I'm working with C#, ASP.NET, Angular.js and Node.js.

If you have any questions or concerns, please don't hesitate to reach our to me!

Need a developer to help turn your vision into reality?

I'm available for freelance work!
Send all inquiries to: freelance@ericanderson.io

Comments and Discussions

 
QuestionLong Path File Pin
Member 1269502120-Aug-16 9:39
Member 1269502120-Aug-16 9:39 
AnswerRe: Long Path File Pin
Member 1276752729-Sep-16 10:20
Member 1276752729-Sep-16 10:20 
QuestionHow i fixed this problem Pin
yuliaree21-Oct-15 8:36
yuliaree21-Oct-15 8:36 
GeneralIt's only 90% MS' fault :) Pin
RobTeixeira1-Oct-15 20:36
RobTeixeira1-Oct-15 20:36 
GeneralRe: It's only 90% MS' fault :) Pin
Eric Anderson IO2-Oct-15 1:14
Eric Anderson IO2-Oct-15 1:14 
When I first encountered this problem I remember thinking that it was probably caused by developer laziness Smile | :) Thanks for you comment. It was quite informative!
QuestionReally Windows? Path is too long? Pin
Derek Jempson1-Oct-15 7:19
Derek Jempson1-Oct-15 7:19 
AnswerRe: Really Windows? Path is too long? Pin
Eric Anderson IO1-Oct-15 11:41
Eric Anderson IO1-Oct-15 11:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.