in reply to Net::FTP wildcard delete?

Looking at the ftp docs at: http://www.w3.org/Protocols/rfc959/4_FileTransfer.html there is no mdel or mdelete command.

I think clients such as ncftp that implement them actually read a list in the background if required (or actually pass the wildcard to the server to deal with - not sure here). I do know ncftp gets its tab completion by pulling up lists in the background, it just hides it unless you actually ask for it.

Replies are listed 'Best First'.
Re^2: Net::FTP wildcard delete?
by dsheroh (Monsignor) on Jun 09, 2006 at 22:05 UTC
    Looks like the server does it. According to man ftp:
    For mdelete and mget, each remote file name is expanded separately on the remote machine and the lists are not merged.
    Of course, if you really want to know how it's done (and you have root access), a packet sniffer is your friend.

      No, "The file list is expanded on the remote machine" does not imply "MDEL is an FTP command". The list is expanded remotely by issuing an NLST command (as shown below). MDEL is not an FTP command.

      ftp> prompt Interactive mode off. ftp> debug <-- Don't need a packet sniffer Debugging on (debug=1). ftp> quote MDEL yoink* <-- remote MDEL ---> MDEL yoink* 500 MDEL yoink*: command not understood. ftp> mdel yoink* <-- local MDEL ---> EPSV ---> NLST yoink* <-- remote expantion ---> DELE yoink <-- individual deletes 250 DELE command successful. ---> DELE yoinks 250 DELE command successful.
        Don't forget the context of my post, namely that I was replying to someone saying they were unsure of whether the wildcard is handled by the client or the server. I didn't mean to imply that MDEL was an FTP command, only that it "Looks like the server does [the wildcard expansion]."

        And thanks for the fuller explanation that NLST is the method by which the wildcard expansion is passed off to the server. I was kind of wondering how the client managed to put in the prompts for each file if the server handled the expansion.