Welcome Guest.   Make a donation to an author on the site September 15, 2014, 11:54:10 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2010! Download 24 custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: My Documents, Desktop and Favourites Backup for all Users on a PC  (Read 4416 times)
scottchamings
Supporting Member
**
Posts: 8

View Profile Give some DonationCredits to this forum member
« on: September 04, 2008, 10:02:07 AM »

Hi,

I would love some code that will go through C:\Documents and Settings and for each user copy their My Documents, Favorites and Desktop folder to another folder structure retaining their username.

eg

copy C:\Documents and Settings\Scott\My Documents to %Path I specify%\Scott\My Documents

I often need to do this and manual copying is just so slow and clumbersome...

Thanks

Scott

Logged
belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: September 04, 2008, 10:32:17 AM »

Scott,

Might give this a try. I have been using it for a while and it works very well.

http://www.karenware.com/...wertools/ptreplicator.asp

-belkira
Logged
scottchamings
Supporting Member
**
Posts: 8

View Profile Give some DonationCredits to this forum member
« Reply #2 on: September 04, 2008, 11:09:52 AM »

This is close but not quite.  I need something that does not need me to select the folders under each of the users names or even know them in advance.

Basically need it to parse all the user ids, start a copy but keep the path structure intact and only copy the My Documents, Favorites and Desktop folders and down for each of the users, even though there might be heaps more folders under each user (Temp etc) which I dont want...
Logged
VideoInPicture
Honorary Member
**
Posts: 467



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: September 04, 2008, 02:48:37 PM »

Attached is a VB Script file that will do what you specified. Just double-click the .vbs file and it will automatically copy the selected folders. Change the strDestination path to change where the copied files are placed.

From your other thread about file copying, I assume you are going to be using this in a corporate environment so a VB Script file is your best choice since it will run on all computers without the need for more software. See the comments in the code for more details.

Quote
Formatted for Visual Basic with the GeSHI Syntax Highlighter [copy or print]
  1. ' CopyUserFiles.vbs
  2. ' VBScript for copying the Document and User files to another directory
  3. ' Coded for Windows XP but can be adapted for 2000 / Vista by changing
  4. ' FavoritesFolder, DesktopFolder, MyDocumentsFolder, strFilePath, and strDestination to suit your needs
  5. '
  6. ' Program runs silently while copying. It may take a while to copy large files.
  7. ' A messagebox will pop up when finished.
  8. '
  9. ' Author: Eric Wong http://circledock.wikidot.com
  10. ' VideoInPicture@gmail.com
  11. ' Version 1.0 - 4th September 2008
  12. ' ----------------------------------------------------------
  13.  
  14. Option Explicit
  15.  
  16. Dim objFSO_DIR, objFolder, objCopyFolder, colSubfolders, objSubfolder
  17. Dim objFSO, objFileCopy
  18. Dim strFilePath, strDestination
  19. Dim fileChecker, objShell
  20. Const OverWriteFiles = True
  21.  
  22. Const FavoritesFolder = "\Favorites"
  23. Const DesktopFolder = "\Desktop"
  24. Const MyDocumentsFolder = "\My Documents"
  25.  
  26. strFilePath = "C:\Documents and Settings"
  27. strDestination ="C:\New Documents and Settings"
  28.  
  29. Set objFSO = CreateObject("Scripting.FileSystemObject")
  30. Set fileChecker = CreateObject("Scripting.FileSystemObject")
  31. Set objShell = CreateObject("Shell.Application")
  32. 'Set objCopyFolder = CreateObject("Shell.Application")
  33.  
  34. objFSO.CreateFolder(strDestination)
  35.  
  36. Set objFSO_DIR = CreateObject("Scripting.FileSystemObject")
  37. Set objFolder = objFSO_DIR.GetFolder(strFilePath)
  38. Set colSubfolders = objFolder.Subfolders
  39.  
  40. 'This is the core of the file copying process
  41. For Each objSubfolder in colSubfolders
  42.    Set objFolder = objFSO.CreateFolder(strDestination & "\" & objSubfolder.Name)  
  43.  
  44.    If fileChecker.FolderExists(objSubfolder & FavoritesFolder) = True Then
  45.       fileChecker.CopyFolder objSubfolder & FavoritesFolder, objFolder & FavoritesFolder, OverWriteFiles
  46.    End If
  47.  
  48.    If fileChecker.FolderExists(objSubfolder & DesktopFolder) = True Then
  49.       fileChecker.CopyFolder objSubfolder & DesktopFolder, objFolder & DesktopFolder, OverWriteFiles
  50.    End If
  51.  
  52.    If fileChecker.FolderExists(objSubfolder & MyDocumentsFolder) = True Then
  53.       fileChecker.CopyFolder objSubfolder & MyDocumentsFolder, objFolder & MyDocumentsFolder, OverWriteFiles
  54.    End If
  55. Next
  56.  
  57. WSCript.Echo "Finished copying selected folders from " & strFilePath & " to " & strDestination
  58. Wscript.Quit


* Capture.PNG (101.48 KB, 672x452 - viewed 365 times.)

* FinishedScreenshot.PNG (81.82 KB, 854x566 - viewed 339 times.)
* Copy Document and User Files.zip (87.41 KB - downloaded 333 times.)
Logged

Author of Circle Dock: http://circledock.wikidot.com
Author of Video In Picture: http://videoinpicture.wikidot.com
Author of Webcam Signature: http://webcamsignature.wikidot.com
Author of Easy Unicode Paster: http://easyunicodepaster.wikidot.com
scottchamings
Supporting Member
**
Posts: 8

View Profile Give some DonationCredits to this forum member
« Reply #4 on: September 04, 2008, 05:19:01 PM »

awesome, thanks, will try out later today on a couple of PCs I need to reimage....
Logged
VideoInPicture
Honorary Member
**
Posts: 467



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: September 04, 2008, 05:41:00 PM »

Just a note: ensure that the folder you specify to copy to doesn't already exist because the program is not set up to overwrite an existing folder and will throw an error. It can be modified to overwrite an existing folder if that is what the goal is.
Logged

Author of Circle Dock: http://circledock.wikidot.com
Author of Video In Picture: http://videoinpicture.wikidot.com
Author of Webcam Signature: http://webcamsignature.wikidot.com
Author of Easy Unicode Paster: http://easyunicodepaster.wikidot.com
lanux128
Global Moderator
*****
Posts: 6,089



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: September 04, 2008, 08:29:53 PM »

cool script! i was going to suggest XXCOPY but i guess with Eric's script, one need not to fiddle with switches. smiley
Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.049s | Server load: 0.1 ]