Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.tcp.ftp.delete
on delete (adrconnectiontable, path) {
<<Changes
<<12/13/01; 11:28:34 AM by JES
<<Created. Delete a file via FTP.
on setDirectory (directory) {
if directory == adrconnectiontable^.currentHostDirectory { //we're already there
return (true)};
response = tcp.ftp.sendCommand (adrconnectiontable, "CWD " + directory);
if not (response beginsWith "2") { //error
scriptError ("Can't delete the file because the server reported an error when attempting to change directories: " + response)};
if directory beginswith "/" {
directory = string.mid (directory, 2, infinity)};
adrconnectiontable^.currentHostDirectory = directory};
local (filename);
bundle { //set filename, possibly modify the path
if path contains "/" {
filename = string.nthfield (path, "/", string.countfields (path, "/"));
path = string.mid (path, 1, sizeof (path) - sizeof (filename))}
else {
filename = path;
path = ""}};
setDirectory (path);
response = tcp.ftp.sendCommand (adrconnectiontable, "DELE " + filename);
if not (response beginsWith "2") { //error
scriptError ("Can't delete the file because the server reported an error: " + response)};
return (true)}
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.