<p>I want to be able to selectively copy a list of files and preserve their directory structure.  The problem is that there are quite a few files that their path exceeds 256 character.  How is this problem usually handled?</p>

<p>Edit:
I should make it clear that I only want to selectively copy files, not folders.  I don't think robocopy can be efficiently used to copy an individual file and it's folder structure effectively.</p>

I wrote a VBscript that checks path length and calls
```
subst
```
, as soon as  a certain threshold is reached. These calls are stacked on each other so that in the middle of a recursion, this layout exists:
```
```
C:\a\very\long\path
subst K: "C:\a\very\long\path"

K:\another\very\long\path
subst L: "K:\another\very\long\path"

L:\yet\another\very\long\path
subst M: "L:\yet\another\very\long\path"

xcopy M:\*.* "D:\target"
```
```
This way with each level of subst, a shorter path is generated. It also means, that you must copy your folders sequentially, to be able check for long paths before you issue the copy command.
Once all files in a folder are copied, the recursion does jump back one level (
```
subst /d
```
), freeing up one drive letter.
Using 4-5 drive letters, that subst each other when the path gets to deep I had been able to copy paths that had lengths waaaaay over the MAX_PATH limit.
EDIT
This describes the general procedure of doing it with subst. How you do it depends on your needs, I always used that little subst trick in a minimal, "solves this single problem" way.
For example, copying to an equally deep target path means you need another stack of subst'ed drive letters.
Unpacking all .zip files within a single, deeply nested directory structure may require only on stack, but you need to shorten the threshold a bit to account for folders in the .zip, etc.