Code:
FUNCTION Backup(RepSource,RepDest)
ON ERROR RESUME NEXT
DIM objSource(1), objDest, objDestCompare
SET objSource(0)=objFSO.GetFolder(RepSource)
ErrCheck
IF NOT objFSO.FolderExists(RepDest) THEN objFSO.CreateFolder(RepDest)
ErrCheck
FOR EACH objFile IN objSource(0).Files
strExt = Right(objFile.Name,4)
SELECT CASE strExt
CASE ".mp3"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".wav"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".gif"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".MOV"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".WMV"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".WMA"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".AVI"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".FLV"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ".exe"
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
CASE ELSE
objSource(1)=objFSO.BuildPath(RepSource,objFile.name)
ErrCheck
objDest=objFSO.BuildPath(RepDest,objFile.name)
ErrCheck
IF objFSO.FileExists(objDest) THEN
SET objDestCompare=objFSO.GetFile(objDest)
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
IF objDestCompare.Size<>objFile.Size Or objDestCompare.DateLastModified<>objFile.DateLastModified THEN
objFile.Copy objDest,TRUE
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
END IF
ELSE
objFile.Copy objDest,TRUE
ErrCheck
objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _
"<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _
"This may take several minutes to complete."
ErrCheck
intFileCount = intFileCount + 1
ErrCheck
IF IsError(err) = TRUE THEN
ErrCheck
LogIt("Backed up file # " & intFileCount & " Had and error.")
ErrCheck
ELSE
ErrCheck
strLogFileName = objFile.Name
ErrCheck
LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName)
ErrCheck
strLogFileName = NOTHING
ErrCheck
END IF
END IF
END SELECT
NEXT
ErrCheck
FOR EACH objFile IN objSource(0).SubFolders
IF objFile.Name = "My Music" Or objFile.Name = "My Videos" Or objFile.Name = "My Pictures" THEN
ELSE
objSource(1)=objFSO.BuildPath(RepSource,objFile.name)
ErrCheck
objDest=objFSO.BuildPath(RepDest,objFile.name)
ErrCheck
Backup objSource(1),objDest
ErrCheck
END IF
NEXT
ErrCheck
SET objSource(0) = NOTHING
SET objSource(1) = NOTHING
SET objDest = NOTHING
SET objDestCompare = NOTHING
END FUNCTION
V/r,
SPC Key
United States Army