Home  >  Article  >  php教程  >  php拷贝文件到相应目录

php拷贝文件到相应目录

PHP中文网
PHP中文网Original
2016-05-25 17:07:061279browse

php代码

<?php
$directory = dirname(__FILE__);//  /var/bigbluebutton
$iterator = new DirectoryIterator($directory);
foreach ($iterator as $fileinfo)
{
    $path = $fileinfo -> getFilename(); //目录名称
    if (!$fileinfo -> isDot() && $fileinfo -> isDir() && $fileinfo -> getMTime() > time()-5 * 60)
    {
        $cp = $directory . "/" . $path . "/" . $path;
        if (!is_dir($directory . $path . "/" . $path . "/L1"))
        {
            echo "not exits;";
            echo "cp /opt/pdfs/* " . $cp;
            system("cp -rf /opt/pdfs/* " . $cp); //将生成好了的pdf文件到/opt/pdfs
        } 
    } 
} 
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Session保存到MemcacheNext article:php定时执行