I have a cronjob that empties a cache directory every day, but sometimes I empty the directory manually (like before I make a site backup) and it takes FOREVER to empty the directory. There's usually around 500 small files in the directory. It takes just as long if I select the directory as when I select all the files. Is there a faster way to do this?
You could try deleting it using PHP, but I think doing by console (SSH) like rllunzmann said would be faster.
Even use cpanel file manager or if you are removing all files in a folder or using wild card you can write a simple php program which can do this very fast Regards Alex
Contact your webhost to have a shell access for your account, then you will be able to empty the cache folder much faster.
Thanks for the tips everyone. I think I'll just continue to use FTP. It's not such a big deal... I was just hoping that there was a faster way of doing it using FTP. I don't want to mess around with shell access, I'm likely to screw things up big time
ftp goes back and forth communicating confirmation between your server and your ftp program, that's why it took such a long time. console (ssh) will be best.