Add a dir_mode to file.managed

Refs #7860. (Includes integration tests.)