I've configured private file system. Using it from UI works well. I want to generate dump site content via devel_generate with custom modifications. So I'm hooking into Node API for assigning sample PDF files to nodes.
Inside private directory I want to create directory structure:
$dir = sprintf('private://org%d/%d/person%d', $this->getOrganization()->nid,
date('Y'), $this->getEmployee()->uid);
if (!file_prepare_directory($dir)) {
throw new Exception('Cannot create document file directory or it\'s not writable');
}
But exception is thrown.
How to set proper directory permissions? Content is generated via drush command - drush genc.