Lassie Posted May 29, 2007 Share Posted May 29, 2007 I have a shopping cart application that stores a customers purchases in a specific directory made available for download via clicking on a link. I would like to destroy the directory ( and purchases) within once a customer has made the download. Could anyone suggest in principle, how to approach this. For example can the directory be set by a timescale to self destruct or can a download of a file be detected to trigger such an event. Quote Link to comment https://forums.phpfreaks.com/topic/53401-deleting-a-download-directory/ Share on other sites More sharing options...
Wildbug Posted May 29, 2007 Share Posted May 29, 2007 See glob(), unlink(), and rmdir(). Also see filemtime() for checking if a file is old enough to qualify for deletion. You can put a file/directory deletion routine in one of your scripts to be run every time the script is run or only at certain times. If you want to go outside of PHP, you can write a script to do so and set it via cron. You can even write a daemon to sit around and check for old files and delete them. Quote Link to comment https://forums.phpfreaks.com/topic/53401-deleting-a-download-directory/#findComment-263877 Share on other sites More sharing options...
Lassie Posted May 29, 2007 Author Share Posted May 29, 2007 I will look into those. Thanks What is cron? Quote Link to comment https://forums.phpfreaks.com/topic/53401-deleting-a-download-directory/#findComment-263915 Share on other sites More sharing options...
Wildbug Posted May 29, 2007 Share Posted May 29, 2007 On what OS are you running this? cron is the scheduling daemon on Unix/Linux/etc. That means you can set a script or program to execute at pre-determined periods, i.e., once a week, twice a day, on Friday, etc. There are similar solutions available for Windows, but I am not familiar with them. You'll probably have to have a little access to the system in order to use them, though. If you won't be able to do that, that's why I also suggested putting the deletion routine in your scripts that will be commonly run. It can be sort of like an "unprivileged" person's cron. Quote Link to comment https://forums.phpfreaks.com/topic/53401-deleting-a-download-directory/#findComment-263921 Share on other sites More sharing options...
Lassie Posted May 29, 2007 Author Share Posted May 29, 2007 Right I follow you.I am running on widows. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/53401-deleting-a-download-directory/#findComment-264004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.