Save the code below as file "Backup_File_AbsensiMesin_EachHour_ADay.vbs"
'----------------------------------------------------------------------------------
'----start code
'----------------------------------------------------------------------------------
OPTION EXPLICIT
dim MyTimeStamp, MyTimeStampPrevDay
dim objFSO, objoutputFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objoutputFile = objFSO.CreateTextFile("Bat_Backup_File_AbsensiMesin_EachHour_ADay.bat")
MyTimeStamp = cstr(year(now)) & _
right(cstr(100+month(now)),2) & _
right(cstr(100+day(now)),2) & "_" & _
right(cstr(100+hour(now)),2) & _
"00"
MyTimeStampPrevDay = cstr(year(now)) & _
right(cstr(100+month(now)),2) & _
right(cstr(100+(day(now)-3)),2)
'----Delete backup file .rar database Day-1
objoutputFile.writeline "del ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStampPrevDay & "_*.*"" "
'--- xcopy /y "SOURCE" "DESTINATION"
objoutputFile.writeline "xcopy /y ""C:\Database\att2000.mdb"" ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_mdb.*"""
objoutputFile.writeline "xcopy /y ""C:\Database\att2000.ldb"" ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_ldb.*"""
'----RAR for Database -SourceExeRar -FileRar -Source
objoutputFile.writeline """C:\DBBackup\BackupDatabaseAbsensiMesin\rar.exe"" a ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_mdb.rar"" C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_mdb.mdb"" "
objoutputFile.writeline """C:\DBBackup\BackupDatabaseAbsensiMesin\rar.exe"" a ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_ldb.rar"" C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_ldb.ldb"" "
'----Delete the copy files
objoutputFile.writeline "del ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_mdb.mdb"""
objoutputFile.writeline "del ""C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_" & MyTimeStamp & "_ldb.ldb"""
objoutputFile.close
'----------------------------------------------------------------------------------
'----end code
'----------------------------------------------------------------------------------
After save the file, double click file "Backup_File_AbsensiMesin_EachHour_ADay.vbs"
and will results file "Bat_Backup_File_AbsensiMesin_EachHour_ADay.bat" - MS-Dos Batch File
If you right-click and edit the file "Bat_Backup_File_AbsensiMesin_EachHour_ADay.bat", you wil see the code below:
'----------------------------------------------------------------------------------
'-----start
'----------------------------------------------------------------------------------
del "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111218_*.*"
xcopy /y "C:\Database\att2000.mdb" "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_mdb.*"
xcopy /y "C:\Database\att2000.ldb" "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_ldb.*"
"C:\DBBackup\BackupDatabaseAbsensiMesin\rar.exe" a "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_mdb.rar" C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_mdb.mdb"
"C:\DBBackup\BackupDatabaseAbsensiMesin\rar.exe" a "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_ldb.rar" C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_ldb.ldb"
del "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_mdb.mdb"
del "C:\DBBackup\BackupDatabaseAbsensiMesin\att2000_20111221_1300_ldb.ldb"
'-------------------------------------------------------------------------------------
'-----end
'-------------------------------------------------------------------------------------
Then, use 2 files :
1. "Backup_File_AbsensiMesin_EachHour_ADay.vbs"
2. "Bat_Backup_File_AbsensiMesin_EachHour_ADay.bat"
in Control Panel > Performance and Maintenance > Scheduled Tasks".
Make a schedule with 2 both of file.