#!/bin/sh
echo '<?xml version="1.0"?>'
echo '<opencv_storage><images>' 
find $1 -type f -print
echo '</images></opencv_storage>'
echo

#!/bin/sh
echo '?xml version="1.0"?>'
echo '<opencv_storage><images>' 
ls $1
echo '</images></opencv_storage>'
echo

--- 
+++ 
@@ -1,6 +1,6 @@
 #!/bin/sh
-echo '?xml version="1.0"?>'
+echo '<?xml version="1.0"?>'
 echo '<opencv_storage><images>' 
-ls $1
+find $1 -type f -print
 echo '</images></opencv_storage>'
 echo
Use find instead of ls to generate XML
