Reputation: 6546
the question is how can i create new folder in my filesystem ? I know how to add file, but how to create an empty folder in specified path ?
Upvotes: 2
Views: 3406
Reputation: 6379
Simply pass true
to the Local
adapter:
use Gaufrette\Adapter\Local as LocalAdapter;
...
$adapter = new LocalAdapter(__DIR__ . '/your-new-dir', true);
$filesystem = new Filesystem($adapter);
Upvotes: 0
Reputation: 441
I'm using the Amazon S3 adaptor, and am able to create a directory using the following:
use Gaufrette\Filesystem;
use Gaufrette\Adapter\AwsS3;
use Aws\S3\S3Client;
$s3Service = S3Client::factory(array("key" => "Your Key Here", "secret" => "Your AWS Secret Here" ));
$adapter = new AwsS3($s3Service,"yourBucketNameHere");
$filesystem = new Filesystem($adapter);
$filesystem->write("new-directory-here/", "");
Upvotes: 3
Reputation: 12033
Then you call write
apapter ensure that directory exist. For example Ftp
public function write($key, $content)
{
$this->ensureDirectoryExists($this->directory, $this->create);
$path = $this->computePath($key);
$directory = dirname($path);
$this->ensureDirectoryExists($directory, true);
...
}
/**
* Ensures the specified directory exists. If it does not, and the create
* parameter is set to TRUE, it tries to create it
*/
protected function ensureDirectoryExists($directory, $create = false)
{
...
}
Upvotes: 0