Added timeout option
Set directory / file mode