On Wed, Apr 22, 2015 at 3:50 PM, Simon Slavin <slavins at bigfraud.org> wrote:
> > On 22 Apr 2015, at 9:40pm, John McKown <john.archie.mckown at gmail.com> > wrote: > > > ?only his app has access to this directory, > > so there are no worries about "somebody else" putting files in it. So I > am > > _guessing_ that there are files in that directory which need to persist > > between executions of his application. > > Correct. > > > Now, if the OP can verify that only > > one instance of his app can run at a time (which means only that > execution > > instance can create/update/delete files in the directory while that > > instance is running), > > Correct. > > > then perhaps it would be possible for the app to keep > > a list of all file names in the given directory which exist before he > > starts up the SQLite portion of the application. Then, after he closes > out > > the SQLite portion of the application, he again scans the directory again > > and deletes all files in the directory which did not exist at the time of > > the initial scan. This might work in a single threaded, single use at a > > time, type application. It would not work if multiple copies/instances of > > the app can run concurrently (hopefully using different SQLite data > bases).? > > The app itself can create and delete other files while it runs. When it > is quit it is possible that some files which previously existed have been > deleted and others created. These files are not SQLite-related files and > can be in a few different formats. But a variation on your solution is > workable: the app keeps a perfect record of which files should exist in its > folder and deletes everything it doesn't know about before quitting. A > strange sort of thing to do but in some situations, maybe this one, it > makes sense. I'll ponder it. > ?Glad it was of some help. You didn't specify the language in which your app is written. If it is C, then you might be able use use #define in such a way that an internal version of creat(), open(), and unlink() are used to "front end" the normal C library routines such that they can update the global list of files created and deleted for tracking. In an extreme situation, I would create my own "port" of SQLite which used this type of logic to ensure that all files were cleaned up. But that is getting very labor intensive. > > Simon. > > PS: Well done Graham. > -- If you sent twitter messages while exploring, are you on a textpedition? He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown