Debt Consolidation | Personal Car Finance | Car Loans | Mobile Phones | CreditCards
Batch script [Archive] - PCMech Forums

PDA

View Full Version : Batch script


healtheworld
05-28-2003, 05:24 PM
Hello Friends..


I hv a system which have two folders in my c: drive. Now these folders hv some set of files and other folders . Now i want to design s batch file or a windows scripting file which can do the following thing
Let me explain it .

I hv two main folders in myhdd .Those folders contains many othe folders and files. and each folder itself contain many other files and folders. Now what io hv to create a new folder which will contain the these two folders and all the folder and unique files of each folder.


lets say folder1 has three folders aa bb and cc ,dd

--->aa has files 11 ,22,33
---->bb has files xx,yy,zz
---->cc has files xxx,yyy,zzz


lets say folder 2 has three folders aa bb and cc ,ee

--->aa has files 11 ,222,333
---->bb has files xx,yy,zzz
---->cc has files xxx,yyyy,zzzz


now the final folder

folder12 should hv folders aa,bb,cc,dd,ee

aa should hv ---> 11,22,33,333,222
bb should hv ---> xx,yy,zz,zzz
cc should hv ---> xxx,yyy,zzz,yyyy,zzzz




If i m correct we hv to design a recursive script...



i m very...very... confused ...



Plz help me

I appreciate every bit of help..

reboot
05-28-2003, 05:40 PM
@echo off
cd\
md myfolder
cd myfolder
md aa
md bb
md cc
xcopy c:\myhdd\folder1\aa\*.* c:\myfolder\aa\*.* /y /s
xcopy c:\myhdd\folder1\bb\*.* c:\myfolder\bb\*.* /y /s
xcopy c:\myhdd\folder1\cc\*.* c:\myfolder\cc\*.* /y /s
xcopy c:\myhdd\folder2\aa\*.* c:\myfolder\aa\*.* /y /s
xcopy c:\myhdd\folder2\bb\*.* c:\myfolder\bb\*.* /y /s
xcopy c:\myhdd\folder2\cc\*.* c:\myfolder\cc\*.* /y /s

healtheworld
05-28-2003, 06:12 PM
Thanx for Immediate help..
But i want a script which will run for n number of directories ..



Waiting 4 ur response

reboot
05-28-2003, 06:35 PM
You can't use wildcards for folder names, you'll have to specify each one.