3 exec tclsh "$0" ${1+"$@"}
5 #----------------------------------------------------------------------
9 # This file installs a hierarchy of data found in the directory
10 # specified by its first argument into the directory specified
13 #----------------------------------------------------------------------
15 # Copyright (c) 2004 Kevin B. Kenny. All rights reserved.
16 # See the file "license.terms" for information on usage and redistribution
17 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
18 #----------------------------------------------------------------------
20 proc copyDir {d1 d2} {
22 puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \
25 file delete -force -- $d2
28 foreach ftail [glob -directory $d1 -nocomplain -tails *] {
29 set f [file join $d1 $ftail]
30 if {[file isdirectory $f] && [string compare CVS $ftail]} {
31 copyDir $f [file join $d2 $ftail]
32 } elseif {[file isfile $f]} {
33 file copy -force $f [file join $d2 $ftail]
34 if {$::tcl_platform(platform) eq {unix}} {
35 file attributes [file join $d2 $ftail] -permissions 0o644
37 file attributes [file join $d2 $ftail] -readonly 1
42 if {$::tcl_platform(platform) eq {unix}} {
43 file attributes $d2 -permissions 0o755
45 file attributes $d2 -readonly 1
50 copyDir [file normalize [lindex $argv 0]] [file normalize [lindex $argv 1]]