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

on writeDirectory () {
		<<11/26/02; 10:22:10 PM by JES
			<<Skip invisible files and files whose names begin with the '.' character.
		<<11/16/02; 12:04:28 PM by DW
			<<Instead of writing out a fttb file, write an XML file. 
		<<11/12/02; 6:08:13 PM by DW
			<<Created. To allow for restoration, we need to have a structure stored in the cloud that tells us what is in the cloud. We store that in directory.fttb, in the top level of the backup directory.
	local (folder =;
	local (xmltext = "", indentlevel = 0);
	on add (s) {
		xmltext = xmltext + (string.filledstring ("\t", indentlevel) + s + "\r\n");};
	on encode (s) {
		if system.environment.isMac { //02/22/2001 JES: convert to Latin text
			return (xml.entityEncode (latinToMac.macToLatin (s), true))}
		else {
			return (xml.entityEncode (s, true))}};
	add ("<?xml version=\"1.0\"?>");
	add ("<files>"); indentlevel++;
	fileloop (f in folder, infinity) {
		if file.filefrompath (f) beginswith "#" {
		if file.filefrompath (f) beginswith "." {
		if not file.isVisible (f) {
		partialpath = string.replaceall (string.delete (f, 1, sizeof (folder)), file.getpathchar (), "/");
		add ("<file path=\"" + encode (partialpath) + "\" created=\"" + date.netstandardstring (file.created (f)) + "\" modified=\"" + date.netstandardstring (file.modified (f)) + "\" size=\"" + file.size (f) + "\"/>")};
	add ("</files>"); indentlevel--;
	f = folder + "files.xml";
	file.surefilepath (f);
	file.writetextfile (f, xmltext)};
	<<bundle //old code, writes an fttb file
		<<local (adrdirectory = @system.temp.radioBackupDirectory)
		<<new (tabletype, adrdirectory)
		<<new (tabletype, @adrdirectory^.files)
		<<local (f, partialpath, adritem)
		<<fileloop (f in folder, infinity)
			<<partialpath = string.replaceall (string.delete (f, 1, sizeof (folder)), file.getpathchar (), "/")
			<<adritem = @adrdirectory^.files.[partialpath]
			<<new (tabletype, adritem)
				<<adritem^.whenCreated = date.netstandardstring (file.created (f))
			<<adritem^.whenModified = date.netstandardstring (file.modified (f))
			<<adritem^.size = file.size (f)
		<<export.sendobject (adrdirectory, folder + "directory.fttb")
bundle { //test code
	writeDirectory ()}

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.