I need to delete all contents (files and folders) in this folder. Problems in a folder contain millions of files and folders inside it. Therefore, I do not want to download all the file names at one time .
The logic should be like this:
- iterate a folder without loading everything
- get file or folder
- delete it (a detailed description of the fact that the file or folder "X" has been deleted)
- go to next
I am trying something like this:
sub main(){ my ($rc, $help, $debug, $root) = (); $rc = GetOptions ( "HELP" => \$help, "DEBUG" => \$debug, "ROOT=s" => \$root); die "Bad command line options\n$usage\n" unless ($rc); if ($help) { print $usage; exit (0); } if ($debug) { warn "\nProceeding to execution with following parameters: \n"; warn "===============================================================\n"; warn "ROOT = $root\n"; }
It works fine, but whenever they "find" it reads a huge folder, the application gets stuck, and I see the system memory for Perl expanding to a timeout. What for? Is he trying to download all the files in one go?
Thanks for your help.
source share