I have a DailyBackup.vbs file that selects two drives and then copies the contents to their own folder for backup purposes. It looks like this:
Option Explicit
Dim FSO, StrDate, StrMonth, StrDay, StrYear, StrBackupFolder1, StrBackupFolder2, CopyFolder1, CopyFolder2, PasteFolder1, PasteFolder2
Const OverWriteFiles = True
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
StrDate = Date()
StrMonth = DatePart("m", StrDate)
StrDay = DatePart("d", StrDate)
StrYear = DatePart("yyyy", StrDate)
StrBackupFolder1 = "I:\Accounting\Backup" & StrMonth & "_" & StrDay & "_" & StrYear
StrBackupFolder2 = "I:\WorkArea\Backup" & StrMonth & "_" & StrDay & "_" & StrYear
If FSO.FolderExists(StrBackupFolder1) Then
'wscript.exit
Else
FSO.CreateFolder(StrBackupFolder1)
wscript.sleep (5 * 1000)
End If
If FSO.FolderExists(StrBackupFolder2) Then
'wscript.exit
Else
FSO.CreateFolder(StrBackupFolder2)
wscript.sleep (5 * 1000)
End If
CopyFolder1 = "D:\"
CopyFolder2 = "H:\"
PasteFolder1 = StrBackupFolder1
PasteFolder2 = StrBackupFolder2
FSO.CopyFolder CopyFolder1 , PasteFolder1 , OverWriteFiles
FSO.CopyFolder CopyFolder2 , PasteFolder2 , OverWriteFiles
I have this running for another company and it works fine. although I am not copying the entire drive in the other one like I am in this one. Would the fact that I am copying an entire drive give me problems?
Option Explicit
Dim FSO, StrDate, StrMonth, StrDay, StrYear, StrBackupFolder1, StrBackupFolder2, CopyFolder1, CopyFolder2, PasteFolder1, PasteFolder2
Const OverWriteFiles = True
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
StrDate = Date()
StrMonth = DatePart("m", StrDate)
StrDay = DatePart("d", StrDate)
StrYear = DatePart("yyyy", StrDate)
StrBackupFolder1 = "I:\Accounting\Backup" & StrMonth & "_" & StrDay & "_" & StrYear
StrBackupFolder2 = "I:\WorkArea\Backup" & StrMonth & "_" & StrDay & "_" & StrYear
If FSO.FolderExists(StrBackupFolder1) Then
'wscript.exit
Else
FSO.CreateFolder(StrBackupFolder1)
wscript.sleep (5 * 1000)
End If
If FSO.FolderExists(StrBackupFolder2) Then
'wscript.exit
Else
FSO.CreateFolder(StrBackupFolder2)
wscript.sleep (5 * 1000)
End If
CopyFolder1 = "D:\"
CopyFolder2 = "H:\"
PasteFolder1 = StrBackupFolder1
PasteFolder2 = StrBackupFolder2
FSO.CopyFolder CopyFolder1 , PasteFolder1 , OverWriteFiles
FSO.CopyFolder CopyFolder2 , PasteFolder2 , OverWriteFiles
I have this running for another company and it works fine. although I am not copying the entire drive in the other one like I am in this one. Would the fact that I am copying an entire drive give me problems?