How to create a udf image of a directory?