in reply to Need Net::FTP delete help

In what sense do you mean "can not delete"?

Do you get an error message from the module? Do you get an error message from the ftp server?

Does deleting a file with a dot at the start of the name work from the command line ftp client? What commands does the command line client send? Does it work if your program sends the same commands?

Replies are listed 'Best First'.
Re^2: Need Net::FTP delete help
by Anonymous Monk on Feb 08, 2017 at 09:24 UTC
    Net::FTP::delete will return a true if it deletes the file
    if ( $ftp->delete ( "$Target/$FileName" ) ) { print "File <$Target/$FileName> was deleted\n"; } else { print "File <$Target/$FileName> failed to delete\n"; }
    I can delete from bash on the server. I have no idea about ftp on Windows as it doesn't support passive and my ftp sever kick it out with great disdain

    The file permissions are all 0755

    I could try from a Linux ftp terminal, but that would be cheating

    I finally broke down and created a cronjob on the ftp server that calls a perl 5 script that changes all files and directories on the target ftp directories that start with a "." to "dot."

    -T

      I asked:

      Does deleting a file with a dot at the start of the name work from the command line ftp client?

      I take this as you trying to address this:

      I can delete from bash on the server.

      This is not what I meant. I meant using a remote machine, using another ftp client.

      If you cannot delete the file using any other FTP client via the ftp server, then the problem is not with Net::FTP but most likely with the ftp server.

      If the Windows default client does not support passive mode, then maybe you can check using curl or wget, or some other approach with a client separate from Net::FTP.

Re^2: Need Net::FTP delete help
by Todd Chester (Scribe) on Feb 10, 2017 at 04:27 UTC
    > Does deleting a file with a dot at the start of the name work from the command line ftp client?

    yes it does from ftp-0.17-70.fc24.x86_64
    Windows ftp client gets its butt kicked out as it doesn't support passive mode

    >What commands does the command line client send?

    delete filename

    >Does it work if your program sends the same commands?

    Can't test as their Internet is down. I will soon try "quot"

    I sincerely appreciate all you guys help

    When the customer's Internet comes back up, I have a test script I will run at it and report over to the bug I created on this at
    https://rt.cpan.org/Public/Bug/Display.html?id=120140
    The bug contain versions etc.
Re^2: Need Net::FTP delete help
by Todd Chester (Scribe) on Feb 10, 2017 at 04:10 UTC
    The command returns a zero. "ls" on the server side confirms the file/directory is still there