On 24/06/2011 10:43, Irfan Sayed wrote: > > i need to delete some directories recursively which are present at > some shared location > > i tried file::path perl module but the issue with that module is , it > is not deleting the root/parent dir > > it deletes the subdirectories and all the files inside that but not > removing root dir > > here is my code: > $path = "\\\\build\\" . "f\$" . > "\\Store\\build\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\" . > $hash_fin{$key}; > > print "$path\n"; > print "**********\n"; > remove_tree($path,{verbose => 1,safe => 1,keep_root => 0}); > > now whaat i expect is , module shud delete the dir which is there in > $path but it does not >
I wonder if you are misunderstanding the keep_root option? Your code should delete the folder named in $hash_fin{$key} and everything beneath it. The tree down to 'zoc' should remain unchanged. Setting safe to true won't help - all it does is prevent remove_tree from altering file permissions in order to delete elements in the tree. Note that \\build\f$ is a shared name, not a folder, and cannot be deleted by rmdir. You should change your code to remove_tree($path, {verbose => 1, safe => 0, keep_root => 0}) or die $!; to show if there are any errors. HTH, Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/