I need to copy content off my site to create another system, because the theme keeps getting hacked. The hacker keeps putting a .ico file that is a malware...
So I need to create a php file that will always search for files NOT NAMED favicon.ico and delete them if it finds them.
Is there a fast way to search every directory in public_html for files hidden and named: .*.ico? They seem to start with . then different names then .ico
so always: .*.ico
but not named: favicon.ico So just a code to delete all files using PHP in public_html that are named .ico but not named favicon.ico
I think unlink would work, but how do I make it not delete favicon.ico?
Does someone know? I'm almost done copying all the content to create a different website and delete the whole website and move the domain to the new server, so it cannot get hacked anymore... but it keeps getting hacked so I have to create a cron job to keep looking for a .ico file to delete.
Thanks in advance if you can point me in the right direction. :)
I've been searching online for how to, but not found it. Need to get it fast because it keeps getting hacked every few hours.
unlink("/home/path/public_html/*.ico");
//Deletes favicon.ico too... right?
did not test it because I think it will delete the ico files I don't want deleted.