Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Need Net::FTP rmdir time out help

by Mr. Muskrat (Canon)
on Feb 01, 2017 at 17:53 UTC ( [id://1180787]=note: print w/replies, xml ) Need Help??


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

You aren't checking if rmdir succeeded or failed. The docs say: "Unless otherwise stated all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will be returned as undef or an empty list."

How can you be sure that it's being terminated early by the next command?

Honestly, you haven't provided enough context for us to offer useful advice.

Replies are listed 'Best First'.
Re^2: Need Net::FTP rmdir time out help
by Todd Chester (Scribe) on Feb 02, 2017 at 06:05 UTC
    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
      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
      Can't you use the first connection for that instead of creating a new one?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1180787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-16 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found