nadeemshafi Posted June 10, 2011 Share Posted June 10, 2011 Hi guys I have to mass delete 1000's of files on api call, i have a queue table but i am thinking of the best way to delete the files without crashing the server, files can range from 1mb to 10gb or more idea 1. 1min cron - check to see if any pending if so exit, otherwise select 50 from queue and foreach mark as 'pending' and delete and mark as done maybe sleep. (file sizes vary so 50 could mean 1 mb or 100gb) idea 2. 1sec cron - check for pending if so exit otherwise select 1 from queue mark as pending and delete then mark as done ( I like this one ) idea 3 select all files with no status and foreach delete and then sleep while(file exists) ( while loop has potential of lockups ) I would appreciate if you could give me some thought son this I like idea 2. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/238964-what-is-the-best-way-to-mass-delete-files/ Share on other sites More sharing options...
gizmola Posted June 17, 2011 Share Posted June 17, 2011 Linux already has nice: http://www.linux.com/archive/feed/58638 Quote Link to comment https://forums.phpfreaks.com/topic/238964-what-is-the-best-way-to-mass-delete-files/#findComment-1230846 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.