|
-
Mar 30th, 2006, 01:54 AM
#1
Thread Starter
Lively Member
[RESOLVED] App not respondning while copying large files
Hey ,
I've made an application that copies files from a folder to another, and it shows the progress in a textbox. (That's why I have a FileListBox)
Well, while copying large files (2-4 GB) the application 'locks itself' and becomes "Not responding". Is there any way how to prevent this? See code below for more details.
VB Code:
start:
Images = "D:\VMware Images\" ' Path were the backup images are
Destination = "D:\Temp\" & temp1 ' Copy to this folder
File1.Path = Images & temp1 ' Copy from this folder
' If old images exist, delete them and make new folder
If Len(Dir$(Destination, vbDirectory)) > 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder Destination, True ' If exist, delete
Set fso = Nothing
MkDir Destination ' And make new
Else
MkDir Destination ' If not exist, make new
End If
' Define number of files to be copied
b = File1.ListCount - 1
' Progress loop starts here
For a = 0 To b
If Text1.Text = "" Then ' Prevents an empty line at the top
Text1.Text = "Copying " & File1.List(a) & "..."
Else
Text1.Text = Text1.Text & vbCrLf & "Copying " & File1.List(a) & "..." ' Text to be shown on the progress-area
End If
Text1.Refresh ' Show the current file in progress-area that is being copied
FileCopy File1.Path & "\" & File1.List(a), Destination & "\" & File1.List(a) ' Defines the Copy from- and the Copy to paths
Next
' Progress loop ends here
The temp1 variable is defined earlier.
Any help is highly appreciated!
rade
EDIT: If you didn't understand something, just ask 
EDIT-2: Even though it becomes "Not responding", it works correctly. When it has finished copying, everything is fine again. I just wonder if you can somehow prevent it to become "Not responding"
Last edited by rade; Mar 30th, 2006 at 01:58 AM.
"Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies."
- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|