Posted to tcl by iobates at Fri Aug 14 19:59:31 GMT 2026view raw
- proc async_copy {src dst} {
- # src is very likely a folder, but occationally a single file
- cd $src
- foreach f [glob *] {
- if {[file isdirectory $f]} {
- # src is directory
- set ndir [file join $dst [file tail $src]]
- mkdir $ndir
- async_copy [file join $src [file tail $ndir]] $ndir
- } else {
- # src is a single file
- set in [open $src r]
- set out [open $dst w]
- fconfigure $in -translation binary
- fconfigure $out -translation binary
- chan copy $in $out
- }
- }
- }
-
Add a comment