@Anthony: Thanks for such a thorough response. I'm sorry I didn't mention for Question 2 that I was deleting the files myself using a method almost identical to the one you presented here. I was just wondering if there was a built-in way to do this more efficiently (less coding). Apparently not, which is OK, since the method presented is pretty simple.
On Question 1 - I continue to investigate and have the following to report. First, I discovered the following exception: TransactionRollbackError: deadlock detected\nDETAIL: Process 6208 waits for ShareLock on transaction 29974; blocked by process 8700.\nProcess 8700 waits for ShareLock on transaction 29973; blocked by process 6208.\nHINT: See server log for query details.\nCONTEXT: SQL statement "DELETE FROM ONLY "public"."my_table" WHERE $1 OPERATOR(pg_catalog.=) "my_file_id""\n This is probably caused by doing a bunch of deletes without a db.commit(). I placed a db.commit() immediately following each delete, and now some of the files are getting deleted, but not all. The static/ data/test.name/??/*.txt files are getting deleted. However the uploads/ test.image/??/*.jpg files are *NOT* getting deleted. So queueing up too many deletes without a db.commit() is at least partially the culprit. Does that make sense? Further testing - I then tried deleting the test record from within the web2py admin application and both files are getting deleted as expected. So then I tried something else ... First, some additional info. There is another table with a Field that refers to this test table and has an ondelete='CASCADE' parameter set. >From within the web2py admin IDE, if I delete the other table first, the test table is not deleted as expected. If I then delete the test table, the static/data/??/*.txt files get deleted but the uploads/ test.image/??/*.jpg files do not. So perhaps the autodelete=True is a red herring. The problem may be with ondelete='CASCADE' pointing to a record with a field with autodelete=True. I hope this helps. This may, indeed, be a bug. Any thoughts?