• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Programming a backup script

Maldian

Senior member
I have VB6 and I am new to programming. I have been given a project to complete and yet I am not sure how to do it. So basically I am looking for some help here if anyone can provide assistance.

I have to come up with a program where it will immediately select a specific folder that has to be backed up to a flash drive (Drive E: ) I have the GUI setup already, but now not sure how Im supposed to get it to work. This program has to be easy for the non-computer savvy people to be able to use it. Basically when they open the program up, they just click the buttong "Backup Data" and it copies all the data in an already specified folder to the E" Drive.

Can anyone help with this?
 
Well I suppose I could add in where they could choose the drive, but the directory they will be copying from will always remain the same.
 
I've done that with batch files/scripts. Forget VB, and just type the following in a file:
Code:
xcopy /S /Y [source folder] E:\[destination folder]
Rename that file to something like backup.bat, and double-click it to run it. Personally, I always zipped my backups, but this xcopy is technically more reliable.
 
Well now what is the command to tell it to find and select the flashdrive for the backup location?

Seems that corporate here keeps changing their mind.
 
Yeah I know that part... what I mean is that my flashdrive may pop up on drive F... and yours may be drive E and another's would be drive G... is there a command that will go detect and automatically put the drive letter in the script location for the backup to go?
 
There are win32 functions to enumerate available drive letters, probably a Google search will find VB6 code for this. Unless you have drive-mapped network shares it's probably the highest drive letter.

Also, something to consider is whether you want to just copy the files or compress them into a single, dated archive. PKZip and WinZip have command-line switches, and there might be some for a freeware app like 7zip.
 
There are win32 functions to enumerate available drive letters, probably a Google search will find VB6 code for this. Unless you have drive-mapped network shares it's probably the highest drive letter.

Also, something to consider is whether you want to just copy the files or compress them into a single, dated archive. PKZip and WinZip have command-line switches, and there might be some for a freeware app like 7zip.

This is why it is pretty much the best solution to have the user pick the destination. There is no really guarantee that anything will be anywhere.

There is a standard windows file dialog that you should use for picking files. I'm too lazy to look it up though 🙂
 
One easy option would be for the USB drive to have a file on it that is always there. Like a marker (could be a hidden file so the user can't see it). Then just have a batch file check each drive letter for said file.

Theoretically, if autorun is enabled, you could just put the copy script on the usb drive and have it backup when it is inserted.
 
Back
Top