求助,谁可以帮写一个批量删除后缀为.bak文件的php

@Ta 2012-01-12 1667点击
老虎的那个在我空间使用要出错,
Warning : include(css.php) [ function.include ]: failed to open stream: No such file or directory in D:\vip\chen9818\web\******\ubb.php online 6
Warning : include() [ function.include ]: Failed opening 'css.php' for inclusion (include_path='.;C:\php5\pear')in D:\vip\chen9818\web\******\ubb.php online 6
(上面是进去时是这样的)
下面是提交过后
Warning : readdir(): supplied argument is not a valid Directory resource in D:\vip\chen9818\web\******\delbak.php on line 15
Warning : readdir(): supplied argument is not a valid Directory resource in D:\vip\chen9818\web\******\delbak.php on line 16
Warning : readdir(): supplied argument is not a valid Directory resource in D:\vip\chen9818\web\******\delbak.php on line 17
Warning : include(css.php) [ function.include ]: failed to open stream: No such file or directory in D:\vip\chen9818\web\******\ubb.php online 6
Warning : include() [ function.include ]: Failed opening 'css.php' for inclusion (include_path='.;C:\php5\pear')in D:\vip\chen9818\web\******\ubb.php online 6
回复列表(3|隐藏机器人聊天)
  • @Ta / 2012-01-12 / /
    未涉猎
  • @Ta / 2012-01-12 / /
    请别乱删除文件!放在任意目录,它将遍历该目录下文件,并删除.bak文件
    <?php
    function scan($dir){
    foreach(glob($dir.'/*') as $i){
    if(is_file($i) AND end(explode('.',$i))=='bak') unlink($i);

    if(is_dir($i)) scan($i);

    }}
    scan('.');
    ?>
  • @Ta / 2012-01-12 / /
    谢谢风车
添加新回复
回复需要登录