<?
$mypipe = popen("ls *.swf -sh1A /home/dw/www/gallery",r);
$dump = fgets($mypipe,255);
while (!(feof($mypipe))) {
$line = fgets($mypipe,255);
$size .= exec("echo $line | cut -d ' ' -f1"); //get filesize through command-line pipes
$size .= "\n";
$name .= exec("echo $line | cut -d ' ' -f2"); // get filename through command-line pipes
$name .= "\n";
}
$fsize = explode("\n",$size);
$fname = explode("\n",$name);
?>
If I do this (ls *.swf -sh1A /home/dw/www/gallery | cut -d " " -f1 or -f2) from the shell, it seperates the listing correctly into a column of file names, and another column of file sizes. When I do this through exec() in php, however, it doesn't seperate correctly. Any ideas on why this doesn't work?