Posted to tcl by patthoyts at Thu Jan 29 12:41:26 GMT 2009view raw
- proc xcopy {src dest recurse {pattern *}} {
- file mkdir $dest
- foreach file [glob -nocomplain [file join $src $pattern]] {
- set base [file tail $file]
- set sub [file join $dest $base]
- # Exclude CVS, SCCS, ... automatically, and possibly the temp
- # hierarchy itself too.
- if {0 == [string compare CVS $base]} {continue}
- if {0 == [string compare SCCS $base]} {continue}
- if {0 == [string compare BitKeeper $base]} {continue}
- # if {[string match ${package_name}-* $base]} {continue}
- if {[string match *~ $base]} {continue}
- if {[file isdirectory $file]} then {
- if {$recurse} {
- file mkdir $sub
- xcopy $file $sub $recurse $pattern
- }
- } else {
- puts -nonewline stdout . ; flush stdout
- file copy -force $file $sub
- }
- }
- }