http://www.perlmonks.org?node_id=1008915

Vijay81 has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

Below script is to print the file content along with folder name where the file sits and it's base folder name. I am able to get the file content and print when ever the file found but problem is everytime it prints first filename and it's folder/basefolder name.

There is main folder name (A2) which has 1 sub folder (MIUY) which inturn has 3 sub folders name (CCT/SST/WMW). All these sub folder has filenames say (CCT023/RETEEYY/WMWMTTY). I was able to capture base folder names and files name but while printing i am not able to pass correct filename/folder name

Can anyone help me out ? File content(will be similar for other files too) :
start putty -ssh -P 2210908A 1009.248090.50904.20001WyhgbvdserMipopA - +l root -pw uyyn.npkju1A
Main script :
#!/usr/bin/perl use warnings; use strict; use File::Find; use Text::CSV; use File::Basename; my $base_dir = 'C:\Test'; # put in your base directory my ($dirname,$filename,$line,$resultfile,@fp,$file); my (@linecolumns,@dir_names,@file,@filenames); find( \&wanted, $base_dir ); sub wanted { return if $_ eq '.' or $_ eq '..'; if (-d) { print " >>> dive into: $_\n" if -d; $dirname = $_; push(@dir_names, basename($_)); } else { #foreach($_){ readout_file($_); ## call subroutine readout_file &write_output;## call subroutine to print std template in outp +ut file print "Output file has been generated successfully.. \n"; #} } }
Sub functions :
#sub function to write input file data into csv format sub readout_file { ($filename) = @_; open my $fh, '<', $filename or die "can't open file:$!"; while (<$fh>) { chomp; s/ /,/g; ## OR s/ /,/g; if you want @linecolumns=split(',',$_); $filename =~ s/.*\///; $filename =~ s/\.[^.]+$//; push(@filenames, $filename); } }
#sub function to write xml format in output file sub write_output{ open ($resultfile, '>>', 'C:\Test\resultfile.dat') or die "Can't open +file: $!"; print $resultfile '<?xml version="1.0" encoding="utf-16"?>'; print $resultfile "\n<!-- **************************************** +************************-->\n"; print $resultfile "<!-- * + *-->\n"; print $resultfile "<!-- * PuTTY Configuration Manager save file - +All right reserved. *-->\n"; print $resultfile "<!-- * + *-->\n"; print $resultfile "<!-- ****************************************** +**********************-->\n"; print $resultfile "<!-- The following lines can be modified at you +r own risks. -->\n"; print $resultfile <<EOF <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="$dir_names[0]" expanded="True"> <container type="folder" name="$dir_names[1]" expanded="True"> <container type="folder" name="$dir_names[2]" expanded="Tr +ue"> <connection type="PuTTY" name="$filenames[0]"> <connection_info> <name>$filenames[0]</name> <protocol>SSH</protocol> <host>$linecolumns[5]</host> <port>$linecolumns[4]</port> <session>Default Settings</session> <commandline>$linecolumns[9]</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> EOF ; print $resultfile "</root>\n"; print $resultfile "</configuration>\n"; #print "Output xml file has been generated successfully.. \n"; }

Output am getting now :

<?xml version="1.0" encoding="utf-16"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> <container type="folder" name="CCT" expanded="True"> <connection type="PuTTY" name="CCT023"> <connection_info> <name>CCT023</name> <protocol>SSH</protocol> <host>1000.24008.50004.20CoioipreA</host> <port>29921</port> <session>Default Settings</session> <commandline>olp.ikmj</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </root> </configuration> <?xml version="1.0" encoding="utf-16"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> <container type="folder" name="CCT" expanded="True"> <connection type="PuTTY" name="CCT023"> <connection_info> <name>CCT023</name> <protocol>SSH</protocol> <host>10098.298748.509984.200901DukectreirecotA< +/host> <port>278721A</port> <session>Default Settings</session> <commandline>Tuytt.nA</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </root> </configuration> <?xml version="1.0" encoding="utf-16"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> <container type="folder" name="CCT" expanded="True"> <connection type="PuTTY" name="CCT023"> <connection_info> <name>CCT023</name> <protocol>SSH</protocol> <host>1009.248090.50904.20001WyhgbvdserMipopA</h +ost> <port>2210908A</port> <session>Default Settings</session> <commandline>uyyn.npkju1A</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </root> </configuration>

output am expecting as

<?xml version="1.0" encoding="utf-16"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> <container type="folder" name="CCT" expanded="True"> <connection type="PuTTY" name="CCT023"> <connection_info> <name>CCT023</name> <protocol>SSH</protocol> <host>1000.24008.50004.20CoioipreA</host> <port>29921</port> <session>Default Settings</session> <commandline>olp.ikmj</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </root> </configuration> <?xml version="1.0" encoding="utf-16"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> <container type="folder" name="SST" expanded="True"> <connection type="PuTTY" name="RETEEYY"> <connection_info> <name>RETEEYY</name> <protocol>SSH</protocol> <host>10098.298748.509984.200901DukectreirecotA< +/host> <port>278721A</port> <session>Default Settings</session> <commandline>Tuytt.nA</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </root> </configuration> <?xml version="1.0" encoding="utf-16"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> <container type="folder" name="WMW" expanded="True"> <connection type="PuTTY" name="WMWMTTY"> <connection_info> <name>WMWMTTY</name> <protocol>SSH</protocol> <host>1009.248090.50904.20001WyhgbvdserMipopA</h +ost> <port>2210908A</port> <session>Default Settings</session> <commandline>uyyn.npkju1A</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </root> </configuration>

Replies are listed 'Best First'.
Re: looping logic error while printing output from folder/flie content
by graff (Chancellor) on Dec 15, 2012 at 03:35 UTC
    You seem to have several problems. First, the XML data you're writing is badly formed. Your "container" tags don't have close tags, your "login" tag has two close tags, and your initial <?xml...> line is declaring "utf-16" encoding, but you don't seem to be writing any utf-16 data (and you probably don't want to) - either leave that line out, or say "utf-8". And you appear to be concatenating a bunch of complete xml streams into one file, which I believe will be rejected by any normal xml parser.

    Second, you are doing too much work trying to keep track of the directory depth yourself - File::Find gives you the path to each file name that it passes to your "wanted" function, so you just need to break that up into the various directory levels.

    Third, you're wasting time with unnecessary operations (repeated use of the "-d" function, repeatedly opening an output file, pushing $filename onto an array every time a line is read from a data file, etc).

    Also, you are writing data into an output file in the same directory that File::Find is scanning, so your output is going to be read as input (which is likely to give you strange results).

    Let me suggest the following - it differs a fair bit from the OP code in terms of how the output is structured, but since the OP output is badly formed, I'm just guessing at the kind of output you really want. It hasn't been tested, of course (since I don't have your data files), but it does compile.

    Note that there's just one subroutine (process_file) for reading and writing content from your data files - that just makes more sense, since the stuff being read needs to go directly to the output. Also, the nesting of "container" tags should reflect the nesting of directories (which I think is probably what you intended to get, eventually).

    #!/usr/bin/perl use strict; use warnings; use File::Find; my $basedir = "C:/Test"; open( my $resultfile, '>', 'C:/SomewhereElse/resultfile.dat' ) or die +"resultfile.dat: $!"; # the next bit should only be written one time per xml output file: print $resultfile <<EOH; <?xml version="1.0" encoding="UTF-8"?> <!-- ****************************************************************- +-> <!-- * *- +-> <!-- * PuTTY Configuration Manager save file - All right reserved. *- +-> <!-- * *- +-> <!-- ****************************************************************- +-> <!-- The following lines can be modified at your own risks. --> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="$basedir" expanded="True"> EOH my @containers; my $indent = ''; find( \&wanted, $basedir ); if ( @containers ) { for ( 0 .. $#containers ) { print "$indent</container>\n"; chop $indent; } } print $resultfile "</root>\n</configuration>\n"; sub wanted { return if ( /^..?$/ ); if ( -d ) { my ( $root, @levels ) = split m{/}, $File::Find::dir; if ( @levels > @containers ) { # push one level deeper $indent .= " "; print $resultfile "$indent<container type=\"folder\" name= +\"$levels[-1]\" expanded=\"True\">\n"; } elsif ( @levels < @containers ) { # pop out one level print $resultfile "$indent</container>\n"; chop $indent; } elsif ( $levels[-1] ne $containers[-1] ) { # same level, diff +erent path print $resultfile "$indent</container>\n"; print $resultfile "$indent<container type=\"folder\" name= +\"$levels[-1]\" expanded=\"True\">\n"; } @containers = @levels; } elsif ( -f _ and -s _ ) { # Note use of "_" (see 'perldoc -f -X') process_file(); } } sub process_file { my $filename = $_; open my $fh, '<', $filename or die "$File::Find::name : $!\n"; my @linecolumns; while (<$fh>) { chomp; my @linecolumns = split; } print $resultfile <<ETX; $indent<connection type="PuTTY" name="$filename"> $indent <connection_info> $indent <name>$filename</name> $indent <protocol>SSH</protocol> $indent <host>$linecolumns[5]</host> $indent <port>$linecolumns[4]</port> $indent <session>Default Settings</session> $indent <commandline>$linecolumns[9]</commandline> $indent <description /> $indent </connection_info> $indent <login> $indent <password /> $indent <prompt /> $indent </login> $indent <timeout> $indent <connectiontimeout>1000</connectiontimeout> $indent <logintimeout>750</logintimeout> $indent <passwordtimeout>750</passwordtimeout> $indent <commandtimeout>750</commandtimeout> $indent </timeout> $indent <command> $indent <command1 /> $indent <command2 /> $indent <command3 /> $indent <command4 /> $indent <command5 /> $indent </command> $indent <options> $indent <loginmacro>False</loginmacro> $indent <postcommands>False</postcommands> $indent <endlinechar>10</endlinechar> $indent </options> $indent</connection> ETX }
    (updated to write any container close tags that are needed after "find()" returns - still, it hasn't been tested)
Re: looping logic error while printing output from folder/flie content
by 2teez (Vicar) on Dec 15, 2012 at 02:36 UTC

    "..but problem is everytime it prints first filename and it's folder/basefolder name.."

    Reason: Because, the first filename "$filenames[0]" is "hardcore" written in your script i.e &write_output subroutine.
    see this

    ... <connection type="PuTTY" name="$filenames[0]"> <connection_info><name>$filenames[0]</name> ...
    The filename is not changing. Likewise are other variables used in your &write_output subroutine.
    You are simply just calling your &write_output subroutine, again and again.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me
Re: looping logic error while printing output from folder/flie content
by Vijay81 (Acolyte) on Dec 16, 2012 at 00:51 UTC

    Thanks Graff for your reply but you script doesn't seems to do what am looking for.

    from my script, all i want to do is replace names of $dir_names[0],$dir_names1,$dir_names2 and $filenames[0] whenever the file foun in the directory path.

    like if 1st file is found in while traversing thru dir/sub dir then va +lues will : $dir_names[0]=A2 $dir_names[1]=MIUY $dir_names[2]=CCT $filenames[0]=CCT023 likewise,when 2nd file is found in another sub directory then values w +ill be : $dir_names[0]=A2 $dir_names[1]=MIUY $dir_names[2]=SST $filenames[0]=RETEEYY
      So... did you solve your problem yet? Did you at least manage to work out what sort of XML output you really want, and are you able to generate parsable XML? Can you see what needs to be done, starting from the sample code I posted?

      (When you want to respond directly to a specific reply, use the "reply" link that comes with the post you are responding to. That way, the person who created the post will be notified about your reply.)

        No Graff. I still not able to slove the problem but saying that I corrected container tags. Thank you very much

        I don't know how to pass the correct subdirlevel1 and subdirlevel2 when the file found.

        I have 3 files in each subdir levels and in all 1st container tag i get the values of subdirelevel1(MIUY) and in 2nd container tag i get the value as filename but not the folder name

        Test file content which resides under A2/MIUY/CCT/CCT023.bat:

        start putty -ssh -P 29921 1000.24008.50004.20CoioipreA -l root -pw olp.ikmj

        Test file content which resides under A2/MIUY/SST/RETEEY.bat

        start putty -ssh -P 278721A 10098.298748.509984.200901DukectreirecotA -l root -pw Tuytt.nA

        Test file content which resides under A2/MIUY/WMW/WMWMTTY.bat

        start putty -ssh -P 2210908A 1009.248090.50904.20001WyhgbvdserMipopA -l root -pw uyyn.npkju1A

        Main script :

        #!/usr/bin/perl use warnings; use strict; use File::Find; use File::Basename; my $base_dir = 'C:\Testdata'; # put in your base directory my ($dirname,$filename,$line,$resultfile,@fp,$file,$basedir1,$subdirle +vel1,$subdirlevel2); my (@linecolumns,@dir_names,@file,@filenames,@filecount); open ($resultfile, '>>', 'C:\Results\resultfile.txt') or die "Can' +t open file: $!"; print $resultfile '<?xml version="1.0" encoding="utf-8"?>'; print $resultfile "\n<!-- ********************-->\n"; print $resultfile "<!-- * *-->\n"; print $resultfile "<!-PuTTY Configuration Manager save file-All ri +ght reserved->\n"; print $resultfile "<!-- * *-->\n"; print $resultfile "<!-- *******************-->\n"; print $resultfile "<!-The following lines can be modified at your +own risks->\n"; opendir(IMD, $base_dir) || die("Cannot open directory"); my @thefiles= readdir(IMD); next if @thefiles eq '.' or @thefiles eq '..'; push(@thefiles, basename($base_dir)); #print $thefiles[2]; closedir(IMD); print $resultfile <<TTX <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="$thefiles[2]" expanded="True"> TTX ; find( \&wanted, $base_dir ); print $resultfile "</root>\n"; print $resultfile "</configuration>\n"; sub wanted { return if $_ eq '.' or $_ eq '..'; if (-d) { print " >>> dive into: $_\n" if -d; $dirname = $_; push(@dir_names, basename($_)); } else { $basedir1 = $dir_names[0]; readout_file($_); ## call subroutine readout_file &write_output($_);## call subroutine to print std template in +output file print "Output file has been generated successfully.. \n"; } }

        Sub functions

        #sub function to write input file data into csv format sub readout_file { ($filename) = @_; open my $fh, '<', $filename or die "can't open file:$!"; while (<$fh>) { chomp; s/ /,/g; ## OR s/ /,/g; if you want @linecolumns=split(',',$_); $filename =~ s/.*\///; $filename =~ s/\.[^.]+$//; push(@filenames, $filename); } foreach(@dir_names){ (my $name,my $dir,my $ext) = fileparse($dir_names[1],'\..*'); $subdirlevel1 = $name; $filename =~ s/.*\///; $filename =~ s/\.[^.]+$//; $subdirlevel2=(basename($filename)); print $dir_names[3], $/; } } #sub function to write xml format in output file sub write_output{ print $resultfile <<EOF <container type="folder" name="$subdirlevel1" expanded="True"> <container type="folder" name="$subdirlevel2" expanded="T +rue"> <connection type="PuTTY" name="$filename"> <connection_info> <name>$filename</name> <protocol>SSH</protocol> <host>$linecolumns[5]</host> <port>$linecolumns[4]</port> <session>Default Settings</session> <commandline>$linecolumns[10]</commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> <login> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </container> </container> EOF ; }

        output :

        <?xml version="1.0" encoding="utf-8"?> <!-- ***********************************************--> <!-- * *--> <!-PuTTY Configuration Manager save file-All right reserved-> <!-- * *--> <!-- ************************************************--> <!-The following lines can be modified at your own risks-> <configuration version="0.1.1.2" savepassword="True"> <root type="database" name="A2" expanded="True"> <container type="folder" name="MIUY" expanded="True"> ### fir +st time getting correct subdirlevel2 name <container type="folder" name="CCT023" expanded="True"> +######## need to get foldername CCT not filename <connection type="PuTTY" name="CCT023"> <connection_info> <name>CCT023</name> <protocol>SSH</protocol> <host>1000.24008.50004.20CoioipreA</host> <port>29921</port> <session>Default Settings</session> <commandline></commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> <login> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </container> </container> <container type="folder" name="MIUY" expanded="True"> ###### N +o need to print this line again <container type="folder" name="RETEEYY" expanded="True"> +######### Need to get correct subdirlevel name which SST <connection type="PuTTY" name="RETEEYY"> <connection_info> <name>RETEEYY</name> <protocol>SSH</protocol> <host>10098.298748.509984.200901DukectreirecotA< +/host> <port>278721A</port> <session>Default Settings</session> <commandline></commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> <login> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </container> ####################### not required </container> <container type="folder" name="MIUY" expanded="True"> ###### N +o need to print this line again <container type="folder" name="WMWMTTY" expanded="True"># +######## Need to get correct subdirlevel name which WMW <connection type="PuTTY" name="WMWMTTY"> <connection_info> <name>WMWMTTY</name> <protocol>SSH</protocol> <host>1009.248090.50904.20001WyhgbvdserMipopA</h +ost> <port>2210908A</port> <session>Default Settings</session> <commandline></commandline> <description /> </connection_info> <login> </login> <password /> <prompt /> <login> </login> <timeout> <connectiontimeout>1000</connectiontimeout> <logintimeout>750</logintimeout> <passwordtimeout>750</passwordtimeout> <commandtimeout>750</commandtimeout> </timeout> <command> <command1 /> <command2 /> <command3 /> <command4 /> <command5 /> </command> <options> <loginmacro>False</loginmacro> <postcommands>False</postcommands> <endlinechar>10</endlinechar> </options> </connection> </container>########################## Not need </container> </root> </configuration>