Uses a pattern for the temporary directory