Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Need Net::FTP rmdir time out help

by Mr. Muskrat (Canon)
on Feb 01, 2017 at 17:53 UTC ( #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
Node Status?
node history
Node Type: note [id://1180787]
help
Chatterbox?
and monks are getting baked in the sun...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2018-07-21 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (445 votes). Check out past polls.

    Notices?