Rename xml filename using the value of an xml-node



I already searched in the forum a way of renaming but I get all sorts of renaming and not the one needed. Change the XML file name using one of the nodes via Batch file (or PowerShell. It is for Windows)


I have a XML file named PO_BLABLA01_XXX.XML and I want to rename the file using a Batch File, making the file name being the PO Number "12345"


So having this content:



<Seller>
<Name>POV AGING LIMITED</Name>
<PO_No>12345</PO_NO>
<AddressInfo>
<agrlib:Address>ALBANY ROAD</agrlib:Address>
<agrlib:Place>DESBOROUGH</agrlib:Place>
<agrlib:Country>United Kingdom</agrlib:Country>
<agrlib:Phone>9999-9999</agrlib:Phone>
</AddressInfo>
<VatRegNo>8888</VatRegNo>
<BankAccount>7777</BankAccount>
</Seller>


I need my file to rename from "PO_BLABLA01_XXX.XML" to 12345.XML that is the value of the < PO_NO > field.


Can anyone point some light for me to follow :) Thanks!


No comments:

Post a Comment