1

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.

Rah
  • 11
  • 1
  • 2
  • See http://stackoverflow.com/questions/180741/how-to-do-something-to-each-file-in-a-directory-with-a-batch-script and http://stackoverflow.com/questions/138497/batch-scripting-iterating-over-files-in-a-directory – Helen Jan 27 '10 at 10:06

3 Answers3

6

Transformation:

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

Copy:

copy *.xml c:\your_target_folder\.
Rubens Farias
  • 57,174
  • 8
  • 131
  • 162
0

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
  • 23,689
  • 4
  • 56
  • 62
0

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.
  • 28,486
  • 9
  • 71
  • 95