rendered paste body<?php
function prn($array)
{
foreach($array as $element)
{
if(!strcmp($element['tag'],"DIRECTORY") && is_array($element['attributes']))
{
$tmp = $element['attributes']['NAME'];
$location[$element['level']] = $tmp;
}
elseif(!strcmp($element['tag'],"FILE"))
{
for($x=1; $x<$element['level']; $x++)
{
echo "/".$location[$x];
}
echo "/".$element['attributes']['NAME']."\n";
}
}
}
//xml file to parse
$xmlfile = 'files.xml';
$xmlparser = xml_parser_create();
// open a file and read data
$fp = fopen($xmlfile, 'r');
$xmldata = fread($fp, 134217700);
xml_parse_into_struct($xmlparser,$xmldata,$values);
xml_parser_free($xmlparser);
prn($values);
//echo "<pre>";
//print_r($values);
//echo "</pre>";
?>
########################################################################################
########################################################################################
########################################################################################
########################################################################################
#!/bin/bash
predir="/media/Data"
comment_block=1
find lost+found -type f -iname "*.*"| while read FILE
do
slash=`expr "$FILE" : '.*\([/].*\)'`
noslash=${slash:1}
fulldir=`cat /media/file_list.txt |grep -F "$noslash"`
if [ $comment_block ]; then
cat /media/file_list.txt |grep -F "$noslash" | while read PLACE
do
dir="${PLACE/$noslash/}"
echo "$noslash"
#echo "$FILE"
#echo "$predir$dir"
echo "$predir$PLACE"
mkdir -p "$predir$dir"
cp "$FILE" "$predir$PLACE"
done
rm -f $FILE
fi
done