copy directory

copy directory

Post by K » Fri, 07 Oct 2005 18:31:43


Hi, I want to copy all the contents of directory "A" , including
sub-folders, to directory "B". Then, zip up directory A and move to
directory C.

The following seems to copy all of A to beneath B? :

set new_project_path "D:/FPGA/PRJ_NAME/CHP_NAME/ISSUE_1B"
set old_project_path "D:/FPGA/PRJ_NAME/CHP_NAME/ISSUE_1A"

file mkdir $new_project_path

file copy $old_project_path $new_project_path


I've tried adding /*.* after both paths, no joy yet.
Haven't tried the zipping bit yet, I guess that'll be ab Exec call to
zip.

TIA, Niv
 
 
 

copy directory

Post by K » Fri, 07 Oct 2005 19:15:31

OK, I've manged to do it with a foreach loop, but explicitly declaring
my known, three, top-level, sub-dirrectories.

So, how do I now create a list of top-level sub-dirs, so it's not so
specific.

TIA, Niv

 
 
 

copy directory

Post by suchenw » Fri, 07 Oct 2005 19:33:00

If you omit the [file mkdir] step, (so that $new_project_path doesn't
exist), [file copy] will create the target dir and copy recursively.
*.* wildcards won't help, they are only used by [glob].
 
 
 

copy directory

Post by K » Fri, 07 Oct 2005 19:40:50

Ta, and how simple!
 
 
 

copy directory

Post by suchenw » Fri, 07 Oct 2005 20:05:58

This is a frequent experience made by Tclers...
"oh, it's simpler than I thought!" :-)