tags:

views:

236

answers:

3

I have a folder containing 1000+ xml files. I need to modify these xml files, for which I am using xslt.

Now the problem that I am facing is that I want to use batch script to do this modification recursively for all the xml files in the folder, rather than doing it manually. How can I do it using batch script?

It would be helpful if anybody could tell me how can I read all the xml files present in a folder and copy them to another folder with the same name.

A: 

Assuming you are using DOS batch ...

A simple copy operation will work:

prompt> copy *.xml destinationDir

To loop and process files individually, we use:

for %%R in (*) do (
  ...
)
KLE
+5  A: 

Transformation:

for /r c:\your_root_folder\ %f in (*.xml) do your_transform_command %f

Copy:

copy *.xml c:\your_target_folder\.
Rubens Farias
NOTE: You'll need to use `%%f` inside a batch file.
Patrick Cuff
+1 for using `for` without `dir` :-)
Joey
A: 

read this

HELP XCOPY,

and this

HELP FOR.

and try this

XCOPY \source\*.xml \destination /S

and try this

FOR %a IN (\source\*.xml) DO echo %a

and now read

HELP CALL

and read

HELP SET

and try this

FOR %a in (\source\*.xml) DO CALL youraction %~na

and by the time you understand what happened you are ready to achieve your goal.

PA