Il tuo kit di base è:
FilesystemIterator - http://php.net/manual/en/class.filesystemiterator.php
file_put_contents / file_get_contents - http://php.net/manual/it/function.file-put-contents.php / http://php.net/manual/it/function.file-get-contents.php
Se riscontri difficoltà, o non sai bene come iniziare, faccelo sapere. Ma prima di chiedere, cerca qualche esempio in rete.