![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 118 Pomógł: 0 Dołączył: 29.07.2003 Skąd: skąd-inąd. Ostrzeżenie: (0%) ![]() ![]() |
W jaki sposób można rekursywnie kasować katalogi przez połączenie
z serwerem FTP (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) ? W manualu http://pl2.php.net/manual/pl/function.ftp-rmdir.php są przykłady, ale żaden z nich nie działa poprawnie ! pomocy. |
|
|
![]() |
![]()
Post
#2
|
|
Administrator serwera Grupa: Przyjaciele php.pl Postów: 909 Pomógł: 0 Dołączył: 12.08.2003 Skąd: /var/www/wroclaw.php Ostrzeżenie: (0%) ![]() ![]() |
Autor poszukuje rozwiązania dla kasowania przez FTP a nie w lokalnym sysemie plików...
Cytat [php:1:0bdfc3d577]<?php
function ftp_rmAll(&$ftp_site,$dir){ $root=$dir; // tmp variable if(@!ftp_chdir($ftp_site,$root)){ // enter the DIRCTORY $root echo 'Directory not found.'; return 0; } if(!empty($dir) && ($file_list=ftp_nlist($ftp_site,'.'))!=0 && $file_list!=NULL) { // list content inside the DIRECTORY $root foreach($file_list as $dir) { if(ftp_size($ftp_site,$dir)===-1){ // dirname ftp_rmAll($ftp_site,$dir); // recursion }else { ftp_delete($ftp_site,$dir); // del file } } } ftp_chdir($ftp_site,'../'); // dir is empty now, move one level up if(ftp_rmdir($ftp_site,$root)) // remove the empty dir return 1; return 0; } ?>[/php:1:0bdfc3d577] This one works well on php4.2.1 + IIS 5.0 + Win 2000 Server NOTE: $file_list!=NULL is needed in IIS platform UpDated: grohu - Posty: 69 Bakus - Posty: 1069 A się fajnie złożyło (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg) |
|
|
![]() ![]() |
![]() |
Aktualny czas: 15.10.2025 - 20:48 |