Basically the above works fine in itself. However now we will require the ability to skip some directories.

Ideally it would be nice to be able to first generate a list of all the directories. All the directories would be kept in a MySQL database (for other reasons) this could be done with a SQL query I'm sure. In the SQL database we will have a field that says delete or not delete basically. Is there someway we can then adapt this to work in the same way and delete files on a schedule excluding "not delete"?

Is it possible to have RM or FIND read from a text file?

I am thinking it would be ideal to issue a SQL query to export all entries with "DELETE" and then have RM read from the exported txt file. (if possible?)

Ideally it would be nice to be able to first generate a list of all the directories. All the directories would be kept in a MySQL database...

cron(8) can run scripts or binaries. Given that your requirements continue to evolve, I would suggest that you move now to a fuller, more sophistated scripting language such as Perl or Python which can read directly from databases as well as text files.

Quote:

Is it possible to have RM or FIND read from a text file?

Scripts can construct commands which are based partly on information maintained in a text file.