Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

VB6 File Copying


  • Please log in to reply
No replies to this topic

#1 Twisted Image

Twisted Image

  • Members
  • 24 posts
  • OFFLINE
  •  
  • Local time:05:10 AM

Posted 05 August 2009 - 10:27 PM

I'm trying to do this using just VB6, and I'm starting to wonder if it's possible. I want to copy entire user profiles from XP, Vista, or W7 systems to a backup folder on an external HDD. I'm trying to keep this as dynamic as possible.

I have been able to copy successfully by using net use to add the current user to the Backup Operators group, and then using xcopy. I want to do this from VB6 without shelling some batch files. The problem is that even if the current user already is in the group, I keep getting "access denied" errors when copying. I've been cruising forums for days trying to figure this out, and while adding the Microsoft Scripting Objects to references, and using FileSystemObjects to copy works on most of the profile, I still have issues with alot of what's contained in AppData (or Application Data in XP), and Local Settings denying permissions. Is there a way to copy files in VB6 that will take the user's security permissions into account? Or is there a way to override or bypass the securities other than this? I even went as far as taking ownership before the copying process, but the best I can do is shell executing xcopy or robocopy afterwards.

My second roadblock is a way to selectively copy these folders. I can do it, but it seems to be a HUGE amount of coding to pull this off. I basically want to avoid useless and commonly infected areas when copying like Temp under AppData and Temporary Internet Files under Local Settings, as well as things I don't want to overwrite after a wipe&reinstall like Credentials and Disc Burning. I see no reason to copy these, but omitting specific folders during the copy seems to involve a HUGE amount of coding. The best method I can come up with is using arrays of arrays to track folder names within paths and checking it against an Access database in which I have a table of folder exceptions for each OS, against which I check each folder before I copy. With the time it'll take to do all this, I could do a thousand wipe and reinstalls, and defeat the purpose, heh.

If I have no choice but to have VB generate a batch file and shell execute it to copy data, I can accept that. But at the very least, I'd like help with the selective copying.

Also, is there a way to add/remove a user to/from a group via VB, or am I going to have to use a shell execution to add the current user to the Backup Operators group?

I've been on forums all over the net, and as I appear to be the only one using VB left, I haven't gotten a response elsewhere. If anyone can help me out with this, I'd be eternally greatful.

-Joel

BC AdBot (Login to Remove)

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users