backup.tcl 500 B

1234567891011121314151617
  1. # Simple script to make a daily backup of certain files
  2. set files-to-backup "statsmod.dat"
  3. set backup-dir "backup/"
  4. bind time - "00 00 * * *" time:backup
  5. proc time:backup {a b c d e} {
  6. global files-to-backup backup-dir
  7. putlog "Backing up..."
  8. if {[string index ${backup-dir} [expr [string length ${backup-dir}] - 1]] != "/"} {
  9. append ${backup-dir} "/"
  10. }
  11. foreach datei ${files-to-backup} {
  12. file copy $datei ${backup-dir}${datei}.[strftime "%Y%m%d" [unixtime]]
  13. }
  14. }