Folder and xml file copy, rename and update based on table d

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
u20110427
Posts: 5
Joined: Wed Apr 27, 2011 9:29 am

Folder and xml file copy, rename and update based on table d

Post by u20110427 »

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 know this is off topic, but I just wanted to ask the experts here if they had any ideas about how this could be done. I know I could just do it by hand, but the thought of doing that seems like a good way to get RSI, so I wondered if there was a smarter way I could do this.

Any advice much appreciated.

Thanks!
Post Reply