Add automatic directory creation for keys and blocks