Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There's a bunch of files on a network drive, on a fairly deep path and the directories on most of of have long names. I think that these were originally created when someone copied & pasted the root directory for this group of files from their local workstation to the shared network drive. I imagine that on the local workstation, there was no problem opening the file, but now that they are on a longer path on the network, Windows can't open them when I double-click. I've also tried copying the files, and renaming them to somethign shorter, but Windows is unable to do that as well.

TL;DR

files from someone's workstation on a (hypothetical) path like this:

C:\Documents and Settings\SomeUser\Files\RootOfLongFileNames\LongSubdirectoryName1\...\VeryLongAndDescriptiveAndSpecificFilename.xls
-----------------------------------------^

have now been copied and pasted on to the network like this:

Q:\Dir1\Dir2\ProjectA\FilesForSomething\SomeotherDirectory\Blahblah\RootOfLongFileNames\LongSubdirectoryName1\...\VeryLongAndDescriptiveAndSpecificFilename.xls
---------------------------------------------------------------------^

And the path is now too long for Windows XP to handle.

Any tips as to how I can read these files?

share|improve this question
    
Ok ! Look at superuser.com/questions/257472/… –  bZezzz Jan 10 '12 at 21:12
    
@bZezzz: That looks like it would work on a file-by-file basis, but I'm looking for some what to make the whole bunch of them accessible all at once. Copying to local workstations would be OK but the long filenames must be preserved (they provide very specific context for the file contents). Also, many users here are not technical enough to start opening files from the command line. Your suggestion might work for me and one other person. –  FrustratedWithFormsDesigner Jan 10 '12 at 21:52
add comment

4 Answers

up vote 7 down vote accepted

Try substituting the path with SUBST.EXE. It comes with Windows:

C:\Users\shufler>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

What you want to do is substitute one of the folders down the chain for a drive letter:

 C:\>subst X: Q:\Dir1\Dir2\ProjectA\FilesForSomething\SomeotherDirectory\Blahblah\RootOfLongFileNames\LongSubdirectoryName1

Now the LongSubdirectoryName1 folder is accessed on the X: drive. When you're done with it you can delete your substitution with subst X: /D

If you need this all the time, then add it to your login script.

Another approach would be to map a drive further down the chain from wherever Q: is mapped.

share|improve this answer
2  
I've recently faced this problem a lot & I've used the SUBST approach. For that purpose, I've found the Visual Subst tool available at ntwind.com/software/utilities/visual-subst.html to be invaluable. –  yosh m Jan 11 '12 at 0:02
    
Awesome trick! Thanks! –  Josh M. Jan 27 '13 at 2:24
add comment

You'll need to rename directory names in the path until the name is short enough for the OS to access.

I'd navigate to the first folder whose name you can modify and rename it to a single letter and then do the same for each subsequent folder until you get to the necessary file.

Regarding the necessity of keeping the structure: There are limitations which we have to work within on Operating Systems, and it is not good to routinely operate outside those parameters. Any quick solution now will only ever be a patch that will need to be re-run again in the future. A true solution will involve reorganizing the directory structure such that this extremely long folder path/file name issue is no longer necessary.

share|improve this answer
    
256 characters. –  bZezzz Jan 10 '12 at 22:08
    
No, they need to use a program that is NOT Windows Explorer, because Windows Explorer is oblivious to the filesystem specs and lazily opts to stick to the least common denominator, making it impossible, for example, to simply copy the existing root of one drive to the root of another identical drive (in capacity, format, etc.) without running into PATH TOO LONG errors. –  Triynko Sep 14 '12 at 5:19
add comment

Prefix the path with \\?\. Note that this doesn’t work with all apps.

share|improve this answer
add comment

EDIT: Originally I suggested using robocopy, but of course this is XP and that doesn't have it pre-installed.

There is no way you will be able to 'give everyone what they want' If the filepath is too long, you won't be able to do any file operations with it. The way I see it, you have a few options:

  1. Follow the steps of the other posts and rename the directories until they are short. The nice thing about computers is you can write a script to not only do this for you, but also keep track of what the original names were. Even with a script, this is bound to be somewhat time consuming.

  2. Get a Linux LiveCD. Put it into the computer and boot from that CD. Go see the Windows disk which will be automounted as a separate filesystem. Get all the files you want and put them into a new folder on your Desktop. Zip that folder and put it on an external hard drive or USB stick or if your network drive allows copying back to the filesystem, move it to a top-level directory.

share|improve this answer
    
I don't have robocopy installed and I'm not sure I have access to install it (it's a work computer). Also, this sounds like a lot of work for each file. My example was simplified: there are actually several directories at several levels too-deep, each containing files that are now inaccessible due to path-too-long issues. I really don't have to time to do this for all the files that everyone wants. –  FrustratedWithFormsDesigner Jan 10 '12 at 22:03
add comment

protected by Community Sep 23 '12 at 17:28

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.