Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.file.uniqueName
on uniqueName (prefix, folder, places=nil, extension = "") { <<New 11/11/97 DW <<follows the pattern of table.uniqueName <<return a unique filename in the indicated folder local (name, ct = 1, f); if places == nil { places = 3}; file.sureFolder (folder); loop { f = folder + prefix + string.padWithZeros (ct, places) + extension; if not file.exists (f) { return (f)}; ct++}} <<bundle <<test code <<local (i, f) <<for i = 1 to 100 <<f = uniqueName ("testfile", "D:\\testfolder\\", 3, ".txt") <<msg (f) <<file.writeWholeFile (f, "xxx")
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.