in reply to Re: Need Net::FTP rmdir time out help
in thread Need Net::FTP rmdir time out help

Problem is that the command instantly terminates and does not wait for the deletion with recurse to complete. The deletions can take up to five minutes to complete. What I am doing now is opening a second connection and looping until the directory disappears. Seems there should be a better way
  • Comment on Re^2: Need Net::FTP rmdir time out help

Replies are listed 'Best First'.
Re^3: Need Net::FTP rmdir time out help
by soonix (Chancellor) on Feb 02, 2017 at 11:44 UTC
    Quoting Mr.Muskrat:
    You aren't checking if rmdir succeeded or failed.
    So, instead of
    $ftp->rmdir ( "${Ordered_List[$Index]}", 1 );
    you should do something like
    if ($ftp->rmdir ( "${Ordered_List[$Index]}", 1 )) { say "rmdir succeeded"; } else { say "rmdir failed"; }
    Aside from permission problems, a recursive rmdir could fail if e.g. deleting the contents takes too long.
      I like the if sequence. Thank you! I had been using the returned message, but there was nothing helpful in it.

      I will have some time on Friday to work on this again, I will get back

      Additional info: I have noticed that once a recursive rmdir has failed, Net::FTP can never deleted the director, no matter how many times I try. (bash works)
      I used the "if". Conclusion: "rmdir recurse" is intermittent. Rats. The code just got a lot more complicated
Re^3: Need Net::FTP rmdir time out help
by salva (Canon) on Feb 02, 2017 at 07:40 UTC
    Can't you use the first connection for that instead of creating a new one?