Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got my batch and it works great!!

Just one thing I would like to add on that. Some of my clients have Folders on the root of C. How can I make the Batch file Pull the WHOLE FOLDERS they add on there to a where I need them without taking the folders like "Programs" "Drivers" Etc.

Scenario: Client has 3 Folders called "Personal 1", "Personal 2", and "Personal 3" but there are other System Folders called "Drivers", "Program Files", "Icons", "WINNT", etc.... Is there a way I can just pull "Personal 1", "Personal 2", and "Personal 3" without having to make a whole new line for each folder? That would be pointless. Thanks!

My Batch File
set /p targetuser="Enter target username: "
xcopy /s/z F:\"Documents and Settings"\%targetuser%\Desktop D:\"Documents and 
Settings"\%username%\Desktop

xcopy /s/z F:\"Documents and Settings"\%targetuser%\Favorites D:\"Documents and Settings"\%username%\Favorites

xcopy /s/z F:\"Documents and Settings"\%targetuser%\"My Documents" D:\"Documents and Settings"\%username%\"My Documents"

xcopy /s/z F:\"Documents and Settings"\%targetuser%\Recent D:\"Documents and Settings"\%username%\Recent
xcopy /s/z F:\"Documents and Settings"\%targetuser%\NetHood D:\"Documents and Settings"\%username%\NetHood

xcopy /s/z F:\"Documents and Settings"\%targetuser%\PrintHood D:\"Documents and Settings"\%username%\PrintHood

xcopy /s/z F:\"Documents and Settings"\%targetuser%\Templates D:\"Documents and Settings"\%username%\Templates

xcopy /s/z F:\"Documents and Settings"\%targetuser%\"Start Menu" D:\"Documents and Settings"\%username%\"Start Menu"

xcopy /s/z F:\"Documents and Settings"\%targetuser%\"Local Settings"\"Application Data"\Microsoft\Outlook D:\"Documents and Settings"\%username%\"Local Settings"\"Application Data"\Microsoft\Outlook

pause

More information: My batch File does pretty much the standard folders. Some Clients has non standard Folders in there C Drive like this photo.

enter image description here

How can I make the batch file take all the folders "data", "fun", and "go" without adding a line in the batch? "xcopy /s/z C:\Data D:\" That would take to much time to do that.


Is there files I can tell the batch file not to pull? like the "program files" or winnt. Sorry I am new to making batch files. Sorry if you dont fully understand.

share|improve this question
3  
I got my batch is not understandable without more information (e.g. the information in superuser.com/questions/518430/batch-file-transfer-addon ). I suggest improving the post. – Hennes Dec 12 '12 at 20:51
    
Please provide more details. How do you handle the list of folders? There could be several possible solutions: Personal* matches all three folders; otherwise you have to list exception folders which should not be handled. – Alexey Ivanov Dec 12 '12 at 20:52
    
sorry. updated. – Daniel Dec 12 '12 at 21:04

Use RoboCopy! See robocopy /? for help.

@echo off
set /p "targetuser=Enter target username: "

:: Your xcopy statements here.  These too can be converted into using robocopy.

:: This will copy from C: into D: including subdirectories, ignoring all files and ignoring the specified folders.
robocopy "C:\" "D:\" /s /mt /xf *.* /xd "C:\Program Files" "C:\Drivers" "C:\WinNT" "C:\Icons"
pause
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .