Home > Backend Development > PHP Tutorial > PHP怎么进行文件备份

PHP怎么进行文件备份

WBOY
Release: 2016-06-13 13:33:22
Original
1274 people have browsed it

PHP如何进行文件备份
我现在有个文件路径是d:/file/XXX.RAR,我想把XXX.RAR备份到d:/file1/XXX.RAR,
XXX.RAR的文件名加上时间戳。。
我只需要执行PHP脚本就备份一次。就可以了

------解决方案--------------------

PHP code

<?php $file = 'd:\\file\\XXX.RAR';
$newfile = 'd:\\file1\\XXX.RAR';

if (!copy($file, $newfile)) {
    echo "failed to copy $file...\n";
}
?> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template