Jump to content

using glob to find a folder


acctman

Recommended Posts

what i'm trying to do here is what ever globistr find for casing, rename the folder to lowercase. is this correct the code below

 


$chid = (strtolower($_POST['chid']));
$findbatch = globistr($chid);
$results = glob($findbatch);

if ( !empty($results) ) {
  $result = $results[0];
  rename("/temp/files/" . $results . "/", "/temp/files/" . strtolower($chid) . "/");
} 
else 
{
    $missing_dir = 'Folder containing files, Not Found: ' . $chid . "\r";
    $errfile = fopen("/rec/" . $chid . "-errlog.txt", "a");
        fwrite($errfile, $missing_dir . "\n");
        fclose($errfile);
        exit();                           
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.