gshaw Posted December 19, 2011 Posted December 19, 2011 While migrating our admin shared areas into a single shared drive I had a lightbulb moment and thought best to check the depth \ length of some of the folder and file names being used by staff... turns out I was in for a shock! There's some huge names that are going over the (stupid and arcane) Windows file path limit of 255 characters, found them by using this rather nifty Powershell command... cmd /c "dir \\?\E:\\ /s/b" | ? {$_.length -gt 254} The only solution in the meantime is to take the output of said nifty command and get staff to rename the offending directories and files, although I can still open them in Windows as far as I can see so far... I do love the post in this thread on Technet forums about it (search for "Why use one word where two will do" within the page!) File name too long cannot copy
Oaktech Posted December 19, 2011 Posted December 19, 2011 try this: Path Too Long | Filename too long | Filename is too long | Path too long utility or unstoppable copy 2
gshaw Posted December 19, 2011 Author Posted December 19, 2011 Thanks for the link, looks to be a nicer version of a similar tool I saw on Google trailing earlier on Nice bit of tech background on why we've still got a 16-year old issue with Windows 7... some things never change!!! Explorer still limited by MAX_PATH Robocopy didn't seem to care about copying the files, everything went over OK but in the long run I've got to stop people being so verbose with folder names 1
Jollity Posted December 21, 2011 Posted December 21, 2011 A good way of dealing with a single long path, without needing any extra tools, is to mount a directory somewhere along the path as a virtual drive with subst. This can the shorten the path below the limit. For example: subst X: C:\myreallylongpath\ del X:\therestofmyreallylongpath.txt I think you can also use a special prefix "\\?\" on paths on the command line to get around the limit. For example: del "\\?\C:\myreallylongpath\therestofmyreallylongpath.txt" Bonus weirdness: a dot at the end of a file name will make it undeletable through explorer. 1
Jollity Posted May 27, 2013 Posted May 27, 2013 the best part is that the program's for free! Though "use" does not include deleting or renaming files. You have to pay $69 for the full version to do that.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now