php 文件操作

记录一下:

      主要是通过php将某个目录下文件根据文件名copy到相应的目录中

       $dirPath = '/test/test/';

       $copyPath = '/123/'

       $dir = opendir($dirPath);

       while( ($file  =  readdir($dir) != false)

       {

            if(!is_dir($file))

            {

                    mkdir($file);

            }

           copy($dirPath.$file,$copyPath.$file);

       }

       closedir($dir);

posted @ 2012-09-20 10:31  风去无痕  阅读(116)  评论(0编辑  收藏  举报