change code to process dir