Move mkdir code to fileutils