|
Posted by Juby on 09/28/27 11:46
Well, that's the weird thing, I've also been having it spit out the
full path, and if I copy and paste the line in the browser to the 'Run'
box, the file opens, no problem. As for the parsing bit, here's what I
have right now (I'm using preg_match, but I've also tried using
explode, neither is working):
$path = "C:\\Users\\AAAHelp\\Variable Identity\\AAA Menu Label [Math
Type]\\";
$directory = dir($path);
$file = file("variables.txt");
$count = count($file);
$foo = TRUE;
function utrim($source){
$temp = ltrim($source);
$temp = rtrim($temp);
$temp = trim($temp);
return $temp;
}
for($i=0;$i<$count;$i++){
$filename = $file[$i];
preg_match("/^\ .+?\ /", $filename, $matches);
$filename = utrim($matches[0]) . ".wmf";
$filename = $path . $filename;
$thisFile = file_exists($filename);
if($thisfile == FALSE){
echo "$filename does not exist.<br />\n";
$foo = FALSE;
}
}
if(file_exists($path . "OpACoeffofPowervsSpeed.wmf")){
echo "Test file okay.<br />\n";
} else {
echo "Test file gone.<br />\n";
}
if($foo){
echo "All variable files present and accounted for.";
}
When run, this script will print out that none of the files exist
(which is false), but then the second test, if(file_exists($path .
"OpACoeffofPowervsSpeed.wmf")), will print out "Test file okay."
Navigation:
[Reply to this message]
|