| View previous topic :: View next topic |
| Author |
Message |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Mon May 06, 2002 4:06 pm Post subject: HELP: Full directory tree copy |
|
|
I am looking to create a util that will do a full recursive copy of a specified directory (something like xcopy). Has anyone had any success doing this with VDS?
I'm using one list to store the subdirs of the source root directory, and another list to store the files in the source root directory.
Step 1) Create target root dir
Step 2) Step through list of files in source root dir and copy to target root dir
Step 3) Step through list of source subdirs and create each one in target root dir, then list files in source subdir and copy to newly created target subdir.
Setp 4) Do it all over again for each subdir of the root directory
Is there an easier way to do this? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon May 06, 2002 7:40 pm Post subject: |
|
|
I take it you don't want to just do:
| Code: |
FILE COPY,C:\FolderName,C:\FolderName2
|
If not you can try something like this to get a list of all files in a directory including files in subdirectories, and then use a repeat loop to go through and copy the files elsewhere:
| Code: |
DIRECTORY CHANGE,C:\FolderName\
RUNH command /c dir/s /B *.* > @PATH(%0)DirList.dat
RUN @PATH(%0)DirList.dat
|
*VDS tag was replacing ">" with ">"*
You can use LIST LoadFile,1,@PATH(%0)DirList.dat to load the file list into a VDS list after it's created. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Lucyfer Newbie

Joined: 06 Apr 2002 Posts: 16 Location: Quebec/Canada
|
Posted: Sat Jun 08, 2002 7:28 pm Post subject: |
|
|
Hortalonus:
I've already coded a software called DataBakk, which I use here and at work to backup directories or single files (I'm currently adding registry keys) to a target path. The use for this came at work, as we are re-installing all computers every year. I use DataBakk to backup files from an old computer and restore them on a new computer.
Do you want to have a look at it, or do you prefer programming your own
There is a problem (reported in a previous Bug Report) with the "list filelist" function. The following:....
| Code: | | List filelist,2,%%FromPath,*SH | will recursively gather all subdirectories from %%FromPath, but as options S[ystem] and H[idden] are used, it will also report system and hidden FILES.
As a workaround, I've added this loop:....
| Code: | List Filelist,2,%%FromPath,*SH
Repeat
If @File(@Item(2),SHZ)
LIST Delete,2
Else
%%Zozo = @Next(2)
End
Until @Null(@Item(2))
|
Any entry reporting a size (even 0) will get zapped from the list. Directories do not report size. |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Tue Jun 11, 2002 7:09 pm Post subject: |
|
|
| Quote: | | Do you want to have a look at it, or do you prefer programming your own |
I would be very interested! Thank you much.  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Jun 23, 2002 3:15 am Post subject: |
|
|
Regarding the LIST FILELIST problem mentioned, if you
add the "D" parameter (for dir), it doesn't list files.
LIST FILELIST, 1, %%source, *DHSR
BTW, I posted a recursive file copy routine I
use in the "VDS3 Source Code" forum:
http://www.vdsworld.com/forum/viewtopic.php?t=367
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Thu Jul 11, 2002 3:06 pm Post subject: |
|
|
| Thanks Mac! Your code worked great. It's exactly what I was looking for. |
|
| Back to top |
|
 |
|