recursion - Recursive delete files using perl script -
i delete file in directory using "rmdir" in perl script. i'm trying clean directory first , trying write file. know can use rmtree (" directory path"); i'm unable use ftp server (use net::ftp;). , rmdir looks empty directory. have tried "remove_tree" , "rm -rf". have read/write access server, i'm unable delete files.
perl script:
finddepth (\&remove_dir, "$path"); rmdir ( "$path" ) or die ("could not remove $path"); sub remove_dir { # path, 0 if ( ! (stat("$file::find::name"))[7] ) { $ftp->rmdir("$file::find::name"); } else { $ftp->unlink("$file::find::name"); } }
$ftp->rmdir($dir_name, 1);
Comments
Post a Comment