Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.upstream.builtinDrivers.fileSystem.deleteMultipleFiles

on deleteMultipleFiles (fileslist, adrspec, adrresponse) {
	<<Changes
		<<1/31/02; 2:47:31 AM by JES
			<<Added support for deleting directories.
		<<1/24/02; 9:18:22 PM by DW
			<<Created.
	local (folder, adrfile, pc = file.getpathchar ());
	folder = adrspec^.folder;
	if not (folder endswith pc) {
		folder = folder + pc};
	new (tabletype, adrresponse);
	adrresponse^.flerror = false;
	adrresponse^.message = "";
	for adrfile in fileslist {
		local (f = nameof (adrfile^));
		local (relativePath);
		if defined (adrfile^.relativePath) {
			relativePath = adrfile^.relativePath}
		else { //folders may not have a relativePath in their filetables
			relativePath = string.delete (adrfile^.upstream.url, 1, sizeOf (adrspec^.url))};
		try {
			if not (relativePath endsWith "/") { //a folder
				local (url = adrfile^.upstream.url);
				local (renderedFileExtension = string.nthfield (url, ".", string.countfields (url, ".")));
				relativePath = string.popSuffix (relativePath) + "." + renderedFileExtension};
			f = adrspec^.folder + string.replaceall (relativePath, "/", pc);
			if f endsWith pc {
				try {file.deleteFolder (f)}}
			else {
				try {file.delete (f)}}}}}



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.