forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


HELP: Full directory tree copy

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Mon May 06, 2002 4:06 pm    Post subject: HELP: Full directory tree copy Reply with quote

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
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon May 06, 2002 7:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Lucyfer
Newbie


Joined: 06 Apr 2002
Posts: 16
Location: Quebec/Canada

PostPosted: Sat Jun 08, 2002 7:28 pm    Post subject: Reply with quote

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 Question

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
View user's profile Send private message Send e-mail
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Tue Jun 11, 2002 7:09 pm    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sun Jun 23, 2002 3:15 am    Post subject: Reply with quote

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 Smile

_________________
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
View user's profile Send private message Send e-mail
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Thu Jul 11, 2002 3:06 pm    Post subject: Reply with quote

Thanks Mac! Your code worked great. It's exactly what I was looking for.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group