Finar.ru
ph-ph.ru
cc-film.ru

Autodeleter

php-скрипт для автоматического удаления файлов

Автор: Филипп Казаков | 2011-03-09 | просмотров 5670
Тэги

Скрипт, удаляет из выбранной директории файлы, удовлетворяющие маске префикс.* , где префикс задается в коде.

Скачать: PhPh_Autodeleter_2011-02-08.zip (скачиваний: 1236)

Код

<?php
## This was coded by Ph&Ph (http://web.finar.ru) This is a script for automatical delete exisiting files satisfying $prefix.*

## here is some config:
$dir = "./"; // directory to delete files from
$prefix = "core"; // to delete filename prefix
## here config finishes.

## -----------Do not modify anything below-----------

if (is_dir($dir)) {
    $dh  = opendir($dir); // opening directory...
    while (false !== ($filename = readdir($dh))) { // reading directory
        if ($filename != "." && $filename != ".." ) { // bypass parent and current dirs
            $pref = current