Posts tagged How to Move Files in Linux using find command

Script to replace the hacked index page server wide

Many times it happens that the hacked index.htm  pages are uploaded by hackers under 
all account's hosted on the server and one has to either remove or rename those hacked
index.htm pages and it becomes very difficult to  rename all  hacked index.htm pages one
by one if there are many accounts hosted on  the affected server.  

So, if you come accross the same situation then don't panic just  use the below 
command to rename all  hacked index.htm pages to index.htm-hacked

[email protected][#]  for i in `find -mindepth 1 -maxdepth 3 -name index.htm`; do  mv $i $i-hacked ;  done

Note :: You can replace index.htm with whatever file name that is affected, for ex : index.php, index.html etc and make sure you are executing the above command in /home directory.

That’s all you are done,  easy isn’t it.