Dear tek-tips members,
I need help with creating a merge script to merge xml files and then a second script to copy the merged file.
I need to be able to run these scripts manually and use task manager or so to run them daily as well.
I need to merge multiple xml files and create a single file of these, then I need a different script to copy these files over their source files(overwrite them).
I need this cause im running some servers which have ban lists, but they all save these ban lists in their own directory as xml, so I need a script to merge these ban lists together and save the merge in its own directory.
then I could edit it to remove bans or add more manually, and then have a 2nd script to copy the merged file back over the old files in their own server directory.
example:
banlist 1:
C:\Users\Gijs\Documents\servers\extinction\Gandanur
IpBans.xml
<?xml version="1.0"?>
<!DOCTYPE IpBans>
-<IpBans> -<IpBan> <Subnet>71.170.66.249</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>186.14.65.26</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>190.131.96.144</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.205.230.223</Subnet> <EndDate>Indefinite</EndDate> </IpBan> </IpBans>
banlist 2:
C:\Users\Gijs\Documents\servers\classic ctf maps\Gandanur
IpBans.xml
<?xml version="1.0"?>
<!DOCTYPE IpBans>
-<IpBans> -<IpBan> <Subnet>200.88.231.60</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.217.70.109</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>186.114.161.178</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.161.137.230</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>71.153.139.138</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>109.75.39.35</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.156.114.169</Subnet> <EndDate>Indefinite</EndDate> </IpBan> </IpBans>
so I need a script that merges those 2(and removes any duplicates), into 1 file and save it in C:\Users\Gijs\Documents\servers as IpBans.xml
and then a second script that copies that main banlist file back to the other banlists and overwrite them(C:\Users\Gijs\Documents\servers\classic ctf maps\Gandanur and C:\Users\Gijs\Documents\servers\extinction\Gandanur)
also could you teach me how to edit this script to add more servers banlist files to merge, and change/add folder locations to save the final banlist to?
thanks for helping me
I need help with creating a merge script to merge xml files and then a second script to copy the merged file.
I need to be able to run these scripts manually and use task manager or so to run them daily as well.
I need to merge multiple xml files and create a single file of these, then I need a different script to copy these files over their source files(overwrite them).
I need this cause im running some servers which have ban lists, but they all save these ban lists in their own directory as xml, so I need a script to merge these ban lists together and save the merge in its own directory.
then I could edit it to remove bans or add more manually, and then have a 2nd script to copy the merged file back over the old files in their own server directory.
example:
banlist 1:
C:\Users\Gijs\Documents\servers\extinction\Gandanur
IpBans.xml
<?xml version="1.0"?>
<!DOCTYPE IpBans>
-<IpBans> -<IpBan> <Subnet>71.170.66.249</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>186.14.65.26</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>190.131.96.144</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.205.230.223</Subnet> <EndDate>Indefinite</EndDate> </IpBan> </IpBans>
banlist 2:
C:\Users\Gijs\Documents\servers\classic ctf maps\Gandanur
IpBans.xml
<?xml version="1.0"?>
<!DOCTYPE IpBans>
-<IpBans> -<IpBan> <Subnet>200.88.231.60</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.217.70.109</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>186.114.161.178</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.161.137.230</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>71.153.139.138</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>109.75.39.35</Subnet> <EndDate>Indefinite</EndDate> </IpBan> -<IpBan> <Subnet>189.156.114.169</Subnet> <EndDate>Indefinite</EndDate> </IpBan> </IpBans>
so I need a script that merges those 2(and removes any duplicates), into 1 file and save it in C:\Users\Gijs\Documents\servers as IpBans.xml
and then a second script that copies that main banlist file back to the other banlists and overwrite them(C:\Users\Gijs\Documents\servers\classic ctf maps\Gandanur and C:\Users\Gijs\Documents\servers\extinction\Gandanur)
also could you teach me how to edit this script to add more servers banlist files to merge, and change/add folder locations to save the final banlist to?
thanks for helping me