Ciao Matteo,
So you want a program that copies files from SOURCE to DESTINATION, while checking it against a REFERENCE - and if anything is missing, write errors to text file.
Do you also want the script to calculate MD5-hashes to verify the files are identical?
Also, would it be permissible to use JavaScript for parts of this task - as long as it runs on OSX?
Hope to hear from you,
Seb