Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.upstream.builtinDrivers.ftp.deleteMultipleFiles
on deleteMultipleFiles (fileslist, adrspec, adrresponse) {
<<Changes
<<1/31/02; 2:44:36 AM by JES
<<Added support for deleting directories.
<<12/13/01; 12:33:26 PM by JES
<<We now have a tcp.delete verb, so we can delete files on an FTP server.
with adrspec^ {
bundle { //set up response table
new (tabletype, adrresponse);
adrresponse^.errorlist = {};
adrresponse^.flerror = false;
adrresponse^.message = ""};
local (password = string (user.radio.prefs.passwords.[passwordname]));
msg ("FTP upstream driver: Opening connection.");
local (adrconnection = tcp.ftp.openConnection (server, username, password, false));
local (adrfile);
for adrfile in fileslist {
local (f = nameof (adrfile^));
local (relativePath = adrfile^.relativePath);
local (filepath);
bundle { //set filepath
filepath = path;
if not (filepath endswith "/") {
filepath = filepath + "/"};
bundle { //hack up the path, sometimes the extension was changed as it was upstreamed
local (url = adrfile^.upstream.url);
local (renderedFileExtension = string.nthfield (url, ".", string.countfields (url, ".")));
relativePath = string.popSuffix (relativePath) + "." + renderedFileExtension};
filepath = filepath + relativePath};
msg ("FTP upstream driver: Deleting \"" + relativePath + "\".");
try {
if filepath endsWith "/" {
tcp.ftp.removeDirectory (adrconnection, filepath)}
else {
tcp.ftp.delete (adrconnection, filepath)};
adrresponse^.errorlist = adrresponse^.errorlist + {""}}
else {
adrresponse^.errorlist = adrresponse^.errorlist + {tryError};
adrresponse^.flerror = true}};
msg ("FTP upstream driver: Closing connection.");
tcp.ftp.closeConnection (adrconnection);
msg ("")}}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.