That is a piece of logic here.
1. You create your app
2. You create another script to execute if the time for purchasing your app has reached.
that is..................
if time > time_to_reg:
destroyapp()
The you have the method destroyapp() coded to remove the files and other stuffs. Hope you got the idea.