dynamically copy all folder and file names ?? 
Author Message
 dynamically copy all folder and file names ??

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 read
the folder names and then copy each one from that reference point onward (to
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 the
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?



Mon, 19 May 2003 03:00:00 GMT  
 dynamically copy all folder and file names ??

Here is a link to a script on my site that should do what you need...

http://cwashington.netreach.net/script_repository/view_scripts.asp?In...

Clarence

Win32Scripting....
No, not that other one..... THE ORIGINAL...
http://cwashington.netreach.net

On THIS site you will find everything you need to get up and running. A
script repository with almost 400 FREE sample scripts, a downloads section
with FREE COM objects for scripting, a library of reference materials and an
online discussion lounge to provide community based technical support. Check
it out.

Quote:

> 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 read
> the folder names and then copy each one from that reference point onward (to
> 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 the
> 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?



Mon, 19 May 2003 03:00:00 GMT  
 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
drive.

Branimir


Quote:
> 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
read
> the folder names and then copy each one from that reference point onward
(to
> 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
the
> 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?



Tue, 20 May 2003 13:24:18 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Copy a file in a folder and past the copy in another folder

2. Copy to file with new name...Copy() and CopyFile() inadequate

3. Copy from folder to folder--how?

4. Copy files and folders VBScript

5. Check if a folder exist and copy files...

6. copy files in folder and subfolder question

7. Copy folder and files

8. Select file and copy to a folder..

9. Permission Denied when copying a file to the SendTo folder

10. Copying a folder and all its subfolders to the file server

11. Copy Folders/Files recursively

12. FSO - copying a file into a created folder

 

 
Powered by phpBB® Forum Software