Can someone please help me here? This is a code snippet of a much bigger subroutine used to copy PST files from a bunch of remote computer onto a backup server. It works by mapping a drive to the remote machine, copying the files as if they were local to a local directory where the final folder is the remote computer\'s name, disconnecting the drive, and then remapping it to another computer. It keeps copying just one file off of every computer, even if there are more files there. Even if the computer doesn\'t have the target folder and any PST files, the one file still shows up on the server as if it had been copied from the computer that didn\'t have it. I can\'t figure out what the deal is; please help. \r\n \r\n
Can someone please help me here? This is a code snippet of a much bigger subroutine used to copy PST files from a bunch of remote computer onto a backup server. It works by mapping a drive to the remote machine, copying the files as if they were local to a local directory where the final folder is the remote computer's name, disconnecting the drive, and then remapping it to another computer. It keeps copying just one file off of every computer, even if there are more files there. Even if the computer doesn't have the target folder and any PST files, the one file still shows up on the server as if it had been copied from the computer that didn't have it. I can't figure out what the deal is; please help.
Code:
Set folderObj = FSO.GetFolder(mapDrive & Right(remoteDir, (Len(remoteDir) - 2)))
If Dir(localDir & client(counter).computer, vbDirectory) = "" Then
MkDir localDir & client(counter).computer
End If
sizeCounter = 0
fileCounter = 0
For Each fileObj In folderObj.Files
sizeCounter = sizeCounter + fileObj.Size
fileCounter = fileCounter + 1
lblStatus.Caption = "Copying: " & fileObj.name
Me.Refresh
FSO.CopyFile fileObj.Path, localDir & client(counter).computer & "\", True
Sleep (500)
Set fileObj2 = FSO.GetFile(localDir & client(counter).computer & "\" & fileObj.name)
If fileObj2.Size <> fileObj.Size Then
With current
.pstQuantity = client(counter).pstQuantity
.pstSize = client(counter).pstSize
.status = "ERROR"
.statusDesc = "File did not copy correctly. Disconnecting from client to avoid further issues."
.success = False
End With
errorCounter = errorCounter + 1
Call log.documentClient(current, counter)
Exit For
End If
log.printNote ("Successfully copied file: " & fileObj.name & " Size: " & fileObj.Size)
Next fileObj
With current
.pstQuantity = fileCounter
.pstSize = sizeCounter
.status = "Complete"
.success = True
.statusDesc = "PST file backup completed successfully."
End With
Call log.documentClient(current, counter)
If Not (disconnDrive(counter)) Then
log.printNote ("ERROR: An error occurred while disconnecting the")
log.printNote ("mapped drive. Execution Aborted")
Call unloadProcedure
End If
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET. subscribe