Jump to content

aezell

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aezell's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am super rusty in PHP after teaching English for two years and I don't think I knew how to do this before. So, please help me learn and understand. I need to take a directory like: $saveDir = "c:/home/www/temp/" and then drill down through whatever directories *might* be in it until I get to a directory with *only* files. I am certain that a directory will contain either 1) another directory or 2) files. The goal eventually is to get down to the files and then copy them to some other place, but drilling down through the possible directories and checking for new directories or files is where I am stumbling. My pseudocode thinking is this: [code] foreach ($item) {   if(is_dir($item)) {     ch_dir($item); } else {     parse_dir($item); // <- not sure how to use this function   } } [/code] Something like that, but I honestly don't have much clue past that. TIA! This is where I am at now. The course_id and session_id are just used in the directory names, so overlook that for the moment. [code]function digDirectory ($handleDir,$course_id,$session_id) {     $permSaveDir = $this->config["htmlRootDir"]."/courses/".$course_id."/".$session_id;     if ($handle = opendir($handleDir)) {         while (false !== ($file = readdir($handle))) {             if (!is_dir($file)) {                 rename($handleDir . "/" . $file,$permSaveDir . "/" $file);             } else {                 $this->digDirectory($file,$course_id,$session_id);             }         }         closedir($handle);     }     return true; }[/code]
×
×
  • 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.