제 스킨에 쓰던 함수입니다.
특정 디렉토리의 파일을 검사하여 생성 시긴으로부터 일정 시간이 지나면 파일을 삭제합니다.
function timeover_file_del($dir,$del_time) {
if (is_dir($dir)) {
$dh = @opendir($dir);
while (false !== ($filename = @readdir($dh))) {
$files[] = $filename;
}
sort($files);
if($files[2]) {
$time2=time();
for ($i=2;$files[$i];$i++){
$ftime=@filemtime($dir.'/'.$files[$i])+$del_time;
if ($ftime<=$time2) {
@unlink($dir.'/'.$files[$i]);
}
}
}
@closedir($dh);
}
}
사용법
timeover_file_del('경로','초단위 시간');
예제
test폴더의 파일들을 검사하여 생성시간으로부터 30초가 지나면 파일을 삭제합니다.
timeover_file_del($g4['path'].'/data/file/'.$bo_table.'/test',30);
특정 디렉토리의 파일을 검사하여 생성 시긴으로부터 일정 시간이 지나면 파일을 삭제합니다.
function timeover_file_del($dir,$del_time) {
if (is_dir($dir)) {
$dh = @opendir($dir);
while (false !== ($filename = @readdir($dh))) {
$files[] = $filename;
}
sort($files);
if($files[2]) {
$time2=time();
for ($i=2;$files[$i];$i++){
$ftime=@filemtime($dir.'/'.$files[$i])+$del_time;
if ($ftime<=$time2) {
@unlink($dir.'/'.$files[$i]);
}
}
}
@closedir($dh);
}
}
사용법
timeover_file_del('경로','초단위 시간');
예제
test폴더의 파일들을 검사하여 생성시간으로부터 30초가 지나면 파일을 삭제합니다.
timeover_file_del($g4['path'].'/data/file/'.$bo_table.'/test',30);
[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
댓글 1개
14년 전
감사합니다 ㅎ
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2630 |
|
15년 전 | 818 | |
| 2629 | 15년 전 | 898 | ||
| 2628 | 15년 전 | 1090 | ||
| 2627 | 15년 전 | 1789 | ||
| 2626 |
angpang
|
15년 전 | 1106 | |
| 2625 |
|
15년 전 | 1198 | |
| 2624 | 15년 전 | 973 | ||
| 2623 | 15년 전 | 918 | ||
| 2622 | 15년 전 | 1289 | ||
| 2621 | 15년 전 | 1744 | ||
| 2620 | 15년 전 | 1021 | ||
| 2619 | 15년 전 | 1362 | ||
| 2618 |
terrorboys
|
15년 전 | 1631 | |
| 2617 |
mummy
|
15년 전 | 987 | |
| 2616 | 15년 전 | 912 | ||
| 2615 |
windday
|
15년 전 | 1062 | |
| 2614 | 15년 전 | 1125 | ||
| 2613 | 15년 전 | 936 | ||
| 2612 | 15년 전 | 1222 | ||
| 2611 | 15년 전 | 1296 | ||
| 2610 | 15년 전 | 1226 | ||
| 2609 | 15년 전 | 3143 | ||
| 2608 |
DiZiNOr
|
15년 전 | 825 | |
| 2607 | 15년 전 | 1372 | ||
| 2606 |
|
15년 전 | 945 | |
| 2605 | 15년 전 | 1762 | ||
| 2604 | 15년 전 | 724 | ||
| 2603 | 15년 전 | 884 | ||
| 2602 |
bitmaster
|
15년 전 | 902 | |
| 2601 | 15년 전 | 905 | ||
| 2600 | 15년 전 | 1645 | ||
| 2599 | 15년 전 | 2940 | ||
| 2598 | 15년 전 | 2025 | ||
| 2597 | 15년 전 | 1935 | ||
| 2596 | 15년 전 | 921 | ||
| 2595 | 15년 전 | 1023 | ||
| 2594 | 15년 전 | 967 | ||
| 2593 |
순천홈페이지
|
15년 전 | 863 | |
| 2592 | 15년 전 | 1149 | ||
| 2591 | 15년 전 | 847 | ||
| 2590 | 15년 전 | 1327 | ||
| 2589 |
dannykim
|
15년 전 | 750 | |
| 2588 |
dannykim
|
15년 전 | 655 | |
| 2587 | 15년 전 | 1536 | ||
| 2586 | 15년 전 | 798 | ||
| 2585 | 15년 전 | 1242 | ||
| 2584 | 15년 전 | 1106 | ||
| 2583 | 15년 전 | 789 | ||
| 2582 | 15년 전 | 808 | ||
| 2581 | 15년 전 | 717 | ||
| 2580 |
|
15년 전 | 696 | |
| 2579 | 15년 전 | 862 | ||
| 2578 | 15년 전 | 1119 | ||
| 2577 | 15년 전 | 2277 | ||
| 2576 |
확실한방법
|
15년 전 | 888 | |
| 2575 | 15년 전 | 980 | ||
| 2574 | 15년 전 | 999 | ||
| 2573 | 15년 전 | 996 | ||
| 2572 | 15년 전 | 1069 | ||
| 2571 |
|
15년 전 | 690 | |
| 2570 | 15년 전 | 1952 | ||
| 2569 |
|
15년 전 | 783 | |
| 2568 | 15년 전 | 1591 | ||
| 2567 | 15년 전 | 747 | ||
| 2566 |
dannykim
|
15년 전 | 761 | |
| 2565 | 15년 전 | 1424 | ||
| 2564 |
기획매니아
|
15년 전 | 1052 | |
| 2563 | 15년 전 | 1333 | ||
| 2562 | 15년 전 | 1624 | ||
| 2561 | 15년 전 | 1263 | ||
| 2560 | 15년 전 | 1349 | ||
| 2559 | 15년 전 | 721 | ||
| 2558 |
|
15년 전 | 2274 | |
| 2557 | 15년 전 | 1015 | ||
| 2556 | 15년 전 | 749 | ||
| 2555 | 15년 전 | 1094 | ||
| 2554 | 15년 전 | 799 | ||
| 2553 | 15년 전 | 2042 | ||
| 2552 | 15년 전 | 1080 | ||
| 2551 | 15년 전 | 909 | ||
| 2550 |
|
15년 전 | 1000 | |
| 2549 | 15년 전 | 954 | ||
| 2548 |
|
15년 전 | 968 | |
| 2547 |
|
15년 전 | 1053 | |
| 2546 | 15년 전 | 550 | ||
| 2545 | 15년 전 | 480 | ||
| 2544 | 15년 전 | 447 | ||
| 2543 | 15년 전 | 1150 | ||
| 2542 |
|
15년 전 | 962 | |
| 2541 | 15년 전 | 812 | ||
| 2540 | 15년 전 | 801 | ||
| 2539 | 15년 전 | 1199 | ||
| 2538 | 15년 전 | 3199 | ||
| 2537 | 15년 전 | 1070 | ||
| 2536 |
|
15년 전 | 1872 | |
| 2535 | 15년 전 | 1149 | ||
| 2534 |
|
15년 전 | 966 | |
| 2533 | 15년 전 | 2604 | ||
| 2532 | 15년 전 | 1611 | ||
| 2531 |
|
15년 전 | 2510 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기