I have a string as follows
command= "copy1 "D:\path1\program Files" "c:\program Files\path1" copy2 "D:\path2\program Files" "c:\program Files\path2""
Note that both copy1 and copy2 are inside the string. My intention was to write each copy process insde an xml file as follows:
<copyFiles>
<copy1>
<Sourcepath>D:\path1\program Files</Sourcepath>
<DestPath>c:\program Files\path1</DestPath>
</copy1>
<copy2>
<Sourcepath>D:\path2\program Files</Sourcepath>
<DestPath>c:\program Files\path2</DestPath>
</copy2>
<copyFiles>
I tried to create a list of each paramter by splitting the string using spaces as follows:
Copyparamlist=command.split(' ')
But I am geeting the xml as follows:
<copyFiles>
<copy1>
<Sourcepath>D:\path1\program</Sourcepath>
<DestPath>c:\program</DestPath>
</copy1>
<copy2>
<Sourcepath>D:\path2\program</Sourcepath>
<DestPath>c:\program</DestPath>
</copy2>
<copyFiles>
The contents of my list should be as follows:
["copy1", "D:\path1\program Files", "c:\program Files\path1", "copy2",
"D:\path2\program Files]", "c:\program Files\path2"]
Please help