Separate mkdir/rmdir from the code.