Zoom7000 Posted April 25, 2012 Posted April 25, 2012 Can anyone help me with a batch script to copy some files from folder to folder en masse? We have a 2 root folders. The first is called "ControlledTests" and in that folder we have 150 home folders called "control01" - "control150". The 2nd root folder is called "HistoryTests" and in that folder we have 150 home folders called "History001" - "History150". What I want to achieve is to copy the contents of each "ControlledTests" home folder in to the respective "HistoryTests" home folder. So: Contents of "control01" copied in to "History001" Contents of "control02" copied in to "History002" Contents of "control03" copied in to "History003" Contents of "control04" copied in to "History004" etc... Any help is very much appreciated!
FN-GM Posted April 25, 2012 Posted April 25, 2012 (edited) Use robocopy or this CODE: robcoopy "C:\Source" "C:\Destination" /MIR If your still on XP / 2003 you will need to install this on the machine you are doing the action: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=15326 Edited April 25, 2012 by FN-GM
pcstru Posted April 25, 2012 Posted April 25, 2012 I don't think robocopy will do the rename of the directories. I can't think of an easy way to do the leading zero's in a batch file - although you can probably look at this thread and figure something out. When I have something like this that is a one off, I tend to use excel to generate the data I need and use the concatenate function too produce a single column containing the final commands I want. It's not particularly re-usable but I can complete the task in a few minutes so it's reasonably efficient for one off's.
FN-GM Posted April 25, 2012 Posted April 25, 2012 Sorry didnt notice that. Yo shoud use the rename command then setup the commands for every folder in Excel. I did this last month.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now