Posted to tcl by iobates at Fri Aug 14 19:59:31 GMT 2026view raw

  1. proc async_copy {src dst} {
  2. # src is very likely a folder, but occationally a single file
  3. cd $src
  4. foreach f [glob *] {
  5. if {[file isdirectory $f]} {
  6. # src is directory
  7. set ndir [file join $dst [file tail $src]]
  8. mkdir $ndir
  9. async_copy [file join $src [file tail $ndir]] $ndir
  10. } else {
  11. # src is a single file
  12. set in [open $src r]
  13. set out [open $dst w]
  14. fconfigure $in -translation binary
  15. fconfigure $out -translation binary
  16. chan copy $in $out
  17. }
  18. }
  19. }
  20.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week