dynamically copy all folder and file names ??
There is nothing wrong with "DOS" XCOPY command (as long as you stay away
from real DOS and stick with 32 bit Win OSes). If your file path is too long
and exceeds prescribed OS limits for file/path length (256 chars if I am not
wrong) you have a problem anyway, and not the one WSH can fix on fly. You
should not be able to exceed the limit in the first place, but... If you
have a really deep, aesthetically almost pleasing structure, and decide that
one of the folders in the middle of the tree could bear a better name, then
change it to something real pretty but too long, system may let you do so -
although it should not. Results may vary depending on by how much you
overshoot. After this, accessing such a file may become difficult (mildly
put). The only remedy to such a problem - when it becomes a problem - is to
truncate folder name(s) at a point close to the root of folder tree.
Before jumping to conclusion that your problem has to do with too long
paths, you may want to ensure that you are not trying to back up opened
files and/or that you have necessary - write permissions for the network
> I have a mapped network drive (an nt4 server) that has about 50,000 files
> contained within 1,000 folders. To do a simple backup to my local hard
> drive, I tried using a DOS batch file, using XCOPY. The problem is that
> the folder structure gets so deep that the length of full paths
> "f:\folder1\folder2\folder3\folder4\file.txt" become too long for "DOS"
> (even the w98 or w2k versions of DOS) and then xcopy fails. I think that
> length is 256. So I thought I could write a WSH script to dynamically
> the folder names and then copy each one from that reference point onward
> shorten the length in case the underlying OS wouldn't like it under WSH
> either). For instance, if it had enumerated 7 folders at the 3rd level
> down, it could just say "copy \folder4" and when it gets to enumerating
> 4th level down it could just "copy file.txt".
> Does anyone have any code to dynamically dive into folder structures and
> copy everything out to a duplicate looking spot on another hard drive?
> Including read-only files and hidden files too?