Folder and xml file copy, rename and update query

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
u20110427
Posts: 1
Joined: 27 Apr 2011 03:35

Folder and xml file copy, rename and update query

#1 Post by u20110427 » 27 Apr 2011 03:38

I have a folder on my PC, and the folder label / name is a number: 58571

The folder contains 2 XML files:

Code: Select all

SearchBoxRN.xml
ShoppingHomePG.xml

Each XML file contains the following tag, amongst others:

Code: Select all

SearchBoxRN.xml contains this tag:
<customization xmlns="http://xmlns.oracle.com/jrad" version="9.0.6.0.0_45" xml:lang="en-US" customizes="/oracle/apps/icx/icatalog/shopping/webui/SearchBoxRN" xmlns:user="http://xmlns.oracle.com/jrad/user" user:responsibilityKey="east_ppl_ppla_por" user:responsibilityAppShortName="ICX">

ShoppingHomePG.xml contains this tag:
<customization xmlns="http://xmlns.oracle.com/jrad" version="9.0.6.0.0_45" xml:lang="en-US" customizes="/oracle/apps/icx/icatalog/shopping/webui/ShoppingHomePG" xmlns:user="http://xmlns.oracle.com/jrad/user" user:responsibilityKey="east_ppl_ppla_por" user:responsibilityAppShortName="ICX">
I have a task where I have to copy the original folder, and rename it with a different ID, and for each of the XML files inside the new folder, change this bit of the XML:

Code: Select all

user:responsibilityKey="east_ppl_ppla_por"
To a different value - as defined in the table below.

I have a table which contains the new folder ID and responsibility keys - there are 105 in total - for example, for 4 rows of data

Code: Select all

ID        responsibilityKey
--------------------------------------------
58571     east_pcy_hd_por
58704     east_pcy_ga_por
58697     east_pcy_pcybs_por
58816     east_pcy_ea_por

I wondered if there is a way I can automate this, perhaps using a batch file, so that for each row in the table:

1. The original folder is copied
2. The new folder is renamed to be the ID of the current row in the table
3. The user:responsibilityKey= section of each xml file is updated to be the responsibilityKey of the current row in the table.

I guess the data doesn't have to be in a table either - if it's possible to do this using a batch file, I could just copy the commands for each ID / key combination.

Any advice much appreciated.

Thanks!

Post Reply