下面是在 Windows 的範例:
set backupfile $env(HOME)
append backupfile "\\My Documents"
append backupfile "\\Homepage-"
append backupfile [clock format [clock seconds] -format %Y%m%d]
append backupfile ".7z"
set backupdir $env(HOME)
append backupdir "\\My Documents"
append backupdir "\\public_html"
set fileExist [file exists $backupfile]
if {$fileExist > 0} {
puts "Now try to remove old backup file."
file delete $backupfile
}
set var [list 7z -ppassword a $backupfile $backupdir]
exec {*}$var
這樣子做就可以建立一個有設密碼的 7zip 檔。
沒有留言:
張貼留言