ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: My Documents, Desktop and Favourites Backup for all Users on a PC

(1/2) > >>

scottchamings:
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

belkira:
Scott,

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

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

-belkira

scottchamings:
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...

VideoInPicture:
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.


--- Code: Visual Basic ---' CopyUserFiles.vbs' VBScript for copying the Document and User files to another directory' Coded for Windows XP but can be adapted for 2000 / Vista by changing' FavoritesFolder, DesktopFolder, MyDocumentsFolder, strFilePath, and strDestination to suit your needs' ' Program runs silently while copying. It may take a while to copy large files. ' A messagebox will pop up when finished.'' Author: Eric Wong http://circledock.wikidot.com' [email protected]' Version 1.0 - 4th September 2008' ---------------------------------------------------------- Option Explicit Dim objFSO_DIR, objFolder, objCopyFolder, colSubfolders, objSubfolderDim objFSO, objFileCopyDim strFilePath, strDestinationDim fileChecker, objShellConst OverWriteFiles = True Const FavoritesFolder = "\Favorites"Const DesktopFolder = "\Desktop"Const MyDocumentsFolder = "\My Documents" strFilePath = "C:\Documents and Settings"strDestination ="C:\New Documents and Settings" Set objFSO = CreateObject("Scripting.FileSystemObject")Set fileChecker = CreateObject("Scripting.FileSystemObject")Set objShell = CreateObject("Shell.Application")'Set objCopyFolder = CreateObject("Shell.Application") objFSO.CreateFolder(strDestination) Set objFSO_DIR = CreateObject("Scripting.FileSystemObject")Set objFolder = objFSO_DIR.GetFolder(strFilePath)Set colSubfolders = objFolder.Subfolders 'This is the core of the file copying processFor Each objSubfolder in colSubfolders    Set objFolder = objFSO.CreateFolder(strDestination & "\" & objSubfolder.Name)       If fileChecker.FolderExists(objSubfolder & FavoritesFolder) = True Then       fileChecker.CopyFolder objSubfolder & FavoritesFolder, objFolder & FavoritesFolder, OverWriteFiles    End If     If fileChecker.FolderExists(objSubfolder & DesktopFolder) = True Then       fileChecker.CopyFolder objSubfolder & DesktopFolder, objFolder & DesktopFolder, OverWriteFiles    End If     If fileChecker.FolderExists(objSubfolder & MyDocumentsFolder) = True Then       fileChecker.CopyFolder objSubfolder & MyDocumentsFolder, objFolder & MyDocumentsFolder, OverWriteFiles    End IfNext WSCript.Echo "Finished copying selected folders from " & strFilePath & " to " & strDestinationWscript.Quit
--- End quote ---

scottchamings:
awesome, thanks, will try out later today on a couple of PCs I need to reimage....

Navigation

[0] Message Index

[#] Next page

Go to full version