Visual Basic is often seen as a tool to create front end GUI intensive applications. However, it can also easily be used to do lower level tasks such as quickly copying one file to another byte by byte. This code snippet demonstrates how you can easily take one file and copy it to a second one as quickly as possible. The way it does this is by pulling the whole file into memory and then writing it back out to the second file name.
This sample demonstrates some of VB's File IO operations such as Open, Get, and Put. It also demonstrates how you can declare a variable array and then change its size using the ReDim construct.
To implement this source code create a new VB6 program, add a button to the form, double click the button to get into its click event handler method, and add the following code within that method.
After running this program and clicking the button you should see a copy of the command.com file created on the C drive with a name of Backup.com. Note: This actually copy's the entire file into memory so you would want to do it in chunks if you were copying a very large file.
Note: The source for this was found at DreamVB which is no longer online.