How to populate custom fields with a script

Hi,
I want to be able to populate custom fields for each domain based on a file in some domains root folder. How do I go about saving variables in script to specific custom fields I have created?

Thanks

John