1.

Solve : Copy particular file and replace it into multiple sub-directories?

Answer»

Hi,

I am NEW in creating complex batch file.

I am having two folders, one is "Master" and another is "Projects". In Master, i have master file named with core.css.

I would LIKE to create a batch file which will search for core.css in Projects folder and its subfolders (apprx. 140) and where find replace it with Master>core.css file.

Anyone can please provide me exact command for this.

Regards,
NitinQuote from: ng2010 on July 05, 2010, 01:45:18 AM

I am having two folders, one is "Master" and another is "Projects". In Master, i have master file named with core.css.

I would like to create a batch file which will search for core.css in Projects folder and its subfolders (apprx. 140) and where find replace it with Master>core.css file.



C:\test>type project0705.bat
@ECHO off
dir /s /b core.css

dir /s /b core.css | findstr "project" > core.txt

echo type core.txt

type core.txt

for /f "delims=" %%i in (core.txt) do (
copy c:\test\master\core.css %%i
)

Output:

C:\test>project0705.bat
C:\test\master\core.css
C:\test\project\project1\core.css
C:\test\project\project3\core.css
type core.txt
C:\test\project\project1\core.css
C:\test\project\project3\core.css
1 file(s) copied.
1 file(s) copied.

C:\test>Thank you so much marvin, it really works for me.

Do you have any IDEA how to apply this approach in VSS like my Projects and Master folder is in VSS so i need to first check out all core.css in folders and subfolders then applied copy command.

e.g. I am using ss checkout $/Projects/project1/core.css

I know it is out of this topic , but would be great if got any help on this.


Discussion

No Comment Found