Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2009, 06:24 AM
Authorized User
 
Join Date: Nov 2005
Posts: 41
Thanks: 6
Thanked 1 Time in 1 Post
Send a message via MSN to RobCarter
Default Copying large files across network

Hi

I have a set of databases that back up to their local machine and a network timeout or something that stops them from backing up over a network share. I am trying to create a system that copies the backup over the network separately to SQL Server.

One of the DBs is 16GB and takes quite a while to copy not sure how long but it's certainly not instantaneous.

the code I have is as follows. essentially what it is meant to do is:
  1. look at the destination folder, check out to see if any duplicate files exist (there will be of course: yesterday's backup)
  2. move any duplicates to a separate archive folder (anywhere out of the way really)
  3. move the new backups in.
an added complication is that the day-before-yesterday's backups will be in the archive folder so i delete those (they are simple backups anyway, so unnecessary)

The code is here:
Code:
Dim folder1 AsNew DirectoryInfo(sSourceDirectory19)
Dim folder1a AsNew DirectoryInfo(sTargetDirectory19)
Dim folder1b AsNew DirectoryInfo(sArchiveDirectory19)
Dim fileList1 As FileInfo() = folder1.GetFiles()
Dim fileList1a As FileInfo() = folder1a.GetFiles()
Dim fileList1b As FileInfo() = folder1b.GetFiles()
Dim file1 As FileInfo
Dim file1a As FileInfo
Dim file1b As FileInfo
Try
IfNot (Directory.Exists(sTargetDirectory19)) Then
Directory.CreateDirectory(sTargetDirectory19)
EndIf
ForEach file1a In fileList1a
'for each backup file in source check to see if there is a 
'file of the same name in the target on R51 (Step1). If there is
'delete any archive files(step3).
'finally move the pre-existing file to archive folder(Step2) and move the backup to the backup folder.
ForEach file1 In fileList1
'Step1
If file1.Name = file1a.Name Then
ForEach file1b In fileList1b
'step2
Debug.Print("Exists " & file1a.Name.ToString)
If file1b.Name = file1a.Name Then
Debug.Print("Archive Exists " & file1b.Name.ToString)
file1b.Delete()
EndIf
Next
'step3
Debug.Print("No files in archive")
file1a.MoveTo(sArchiveDirectory19 & file1a.Name)
file1.MoveTo(sTargetDirectory19 & "\" & file1.Name)
Else
Debug.Print("Not exists " & file1.Name.ToString)
EndIf
Debug.Print("last file = " & file1.Name.ToString)
Next
'file1.MoveTo(sTargetDirectory19 & "\" & file1.Name)
 
 
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
file1 = Nothing
fileList1 = Nothing
folder1 = Nothing
file1a = Nothing
fileList1a = Nothing
folder1a = Nothing
file1b = Nothing
fileList1b = Nothing
folder1b = Nothing
EndTry
When copying the 16Gig file the code runs but once it has done step3, the for loop doesn't go on the Next statement to start again. It doesn;t even hit the End If. The only exception I have got from the runtime is that the network name is no longer available which is not correct.

I think some kind of timeout is at work but I haven't the faintest idea how I sort it out.

Can someone help to give me an I dea of where I go from here?

Thanks in advance

Rob.
__________________
Rob Carter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading large files ravichandrae Pro Java 1 January 11th, 2008 04:42 AM
Copying files error kwik10z Excel VBA 1 November 10th, 2007 10:11 PM
Copying data across files sda443 Excel VBA 2 January 16th, 2006 06:49 AM
Copying files using VBScript in ADO 3.0 munrrob Classic ASP Basics 2 October 26th, 2004 05:35 AM
Copying files marclena General .NET 2 June 18th, 2004 08:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.