|
-
January 17th, 2008, 03:54 PM
#1
Copying big files over 4GBytes with the percentage of the copy display.
I was dragging a file 5.6 GBytes from my C: drive to a second hard drive with 73 GBytes of free space.
but Windows Explorer would display the 'Not enough free disc space' error.
So I am now writing a program to copy big files.
As copying a big file will take some time, the code should be fast and display a percentage of the data copied as it copies it.
The Microsoft Scripting Runtime FileSystemObject is fast but if file is over 4GB's then no file is created (and no error message)
The FileCopy CopyThisFile, AsThisFile will copy the first 4GB's then displays a 'No disc space' error.
Using 'Open files as binary' you can display the percentage but is very very slow and so can't check if it works with files over 4GB's
Any ideas on how this could be done.
Code:
[Code 1]
Dim fso As FileSystemObject
Set fso = New FileSystemObject
fso.CopyFile CopyThisFile, AsThisFile
No AsThisFile created and no error message if file is over 4GB's
My fastest method.
[Code 2]
FileCopy CopyThisFile, AsThisFile
Copyes the first 4GB's only (with error message)
Second fastest method.
[Code 3]
Dim copyFromHandel As *******, copyToHandel As Integer
Dim MovingData As String
copyFromHandel = FreeFile
Open CopyThisFile For Binary Access Read Lock Read As #copyFromHandel
copyToHandel = FreeFile
Open AsThisFile For Binary Access Write As #copyToHandel
Do While (Not EOF(copyFromHandel)) And CopyingData
Get #copyFromHandel, , MovingData
Put #copyToHandel, , MovingData
Loop
Close #copyToHandel
copyToHandel = 0
Close #copyFromHandel
copyFromHandel = 0
Only tested upto 212,950 KBytes due to a very slow time to copy data.
This is a very slow method. (1 day to copy 280,000 KBytes)
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
|