I wish clean up one directory into s3. This directory have a lot of
images, but i don't want to delete image by image. So, when I try to
do something like:
bucket = "sk-dev"
directory = storage.directories.get(bucket)
directory.destroy
I get, this message: The bucket you tried to delete is not empty
My aim is delete everything in the bucket, and then uploads new
images.
> I wish clean up one directory into s3. This directory have a lot of
> images, but i don't want to delete image by image. So, when I try to
> do something like:
> bucket = "sk-dev"
> directory = storage.directories.get(bucket)
> directory.destroy
> I get, this message: The bucket you tried to delete is not empty
> My aim is delete everything in the bucket, and then uploads new
> images.
On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> wrote: > Hi everyone.
> I wish clean up one directory into s3. This directory have a lot of > images, but i don't want to delete image by image. So, when I try to > do something like:
> bucket = "sk-dev"
> directory = storage.directories.get(bucket)
> directory.destroy
> I get, this message: The bucket you tried to delete is not empty
> My aim is delete everything in the bucket, and then uploads new > images.
Is there a way to access a nested directory so that you can iterate
through it? So if I have a directory 6 levels deep with 10 images in
it how would I get that directory that I want to iterate through?
On Mar 2, 1:24 pm, John Vincent <lusis....@gmail.com> wrote:
> On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> wrote:
> > Hi everyone.
> > I wish clean up one directory into s3. This directory have a lot of
> > images, but i don't want to delete image by image. So, when I try to
> > do something like:
> > bucket = "sk-dev"
> > directory = storage.directories.get(bucket)
> > directory.destroy
> > I get, this message: The bucket you tried to delete is not empty
> > My aim is delete everything in the bucket, and then uploads new
> > images.
The cloud providers don't actually provide for nested directories. In
the end they just have long keys that contain many '/' characters. As
such you can probably limit the list down to stuff with the prefix
option and then iterate over those.
On Apr 13, 8:17 am, Nic <nicolas.fedd...@gmail.com> wrote:
> Is there a way to access a nested directory so that you can iterate
> through it? So if I have a directory 6 levels deep with 10 images in
> it how would I get that directory that I want to iterate through?
> On Mar 2, 1:24 pm, John Vincent <lusis....@gmail.com> wrote:
> > As Wes said, there's not a uniform way to do that. You'll have to
> > iterate the contents.
> > However, depending on the size of the bucket, you'll run into the 1k
> > key limit. I'll save you some searching now ;)
> > On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> wrote:
> > > Hi everyone.
> > > I wish clean up one directory into s3. This directory have a lot of
> > > images, but i don't want to delete image by image. So, when I try to
> > > do something like:
> > > bucket = "sk-dev"
> > > directory = storage.directories.get(bucket)
> > > directory.destroy
> > > I get, this message: The bucket you tried to delete is not empty
> > > My aim is delete everything in the bucket, and then uploads new
> > > images.
Guess I missed this when it came in, sorry. Again Wes beat me to it. In the case of S3, the "directory" structure you're seeing is just bucket names or keys with "/" in the name. S3 originally didn't even have support for that. It was bucket + contents.
One option you might want to try down the road is, depending on how you're putting stuff in the bucket, is to maintain an "index" bucket somewhere. It's not as pretty but you could have a bucket called, say, "my-bucket-indexes" and put a single file per bucket in there. The file would contain a list of items in a given bucket. The you just iterate over the contents of the file to clean out the bucket when it gets to a certain size.
On Wed, Apr 13, 2011 at 11:17 AM, Nic <nicolas.fedd...@gmail.com> wrote: > Is there a way to access a nested directory so that you can iterate > through it? So if I have a directory 6 levels deep with 10 images in > it how would I get that directory that I want to iterate through?
> On Mar 2, 1:24 pm, John Vincent <lusis....@gmail.com> wrote: >> As Wes said, there's not a uniform way to do that. You'll have to >> iterate the contents.
>> However, depending on the size of the bucket, you'll run into the 1k >> key limit. I'll save you some searching now ;)
>> On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> wrote: >> > Hi everyone.
>> > I wish clean up one directory into s3. This directory have a lot of >> > images, but i don't want to delete image by image. So, when I try to >> > do something like:
>> > bucket = "sk-dev"
>> > directory = storage.directories.get(bucket)
>> > directory.destroy
>> > I get, this message: The bucket you tried to delete is not empty
>> > My aim is delete everything in the bucket, and then uploads new >> > images.
> The cloud providers don't actually provide for nested directories. In
> the end they just have long keys that contain many '/' characters. As
> such you can probably limit the list down to stuff with the prefix
> option and then iterate over those.
> On Apr 13, 8:17 am, Nic <nicolas.fedd...@gmail.com> wrote:
> > Is there a way to access a nested directory so that you can iterate
> > through it? So if I have a directory 6 levels deep with 10 images in
> > it how would I get that directory that I want to iterate through?
> > On Mar 2, 1:24 pm, John Vincent <lusis....@gmail.com> wrote:
> > > As Wes said, there's not a uniform way to do that. You'll have to
> > > iterate the contents.
> > > However, depending on the size of the bucket, you'll run into the 1k
> > > key limit. I'll save you some searching now ;)
> > > On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> wrote:
> > > > Hi everyone.
> > > > I wish clean up one directory into s3. This directory have a lot of
> > > > images, but i don't want to delete image by image. So, when I try to
> > > > do something like:
> The cloud providers don't actually provide for nested directories. In
> the end they just have long keys that contain many '/' characters. As
> such you can probably limit the list down to stuff with the prefix
> option and then iterate over those.
> On Apr 13, 8:17 am, Nic <nicolas.fedd...@gmail.com> wrote:
> > Is there a way to access a nested directory so that you can iterate
> > through it? So if I have a directory 6 levels deep with 10 images in
> > it how would I get that directory that I want to iterate through?
> > On Mar 2, 1:24 pm, John Vincent <lusis....@gmail.com> wrote:
> > > As Wes said, there's not a uniform way to do that. You'll have to
> > > iterate the contents.
> > > However, depending on the size of the bucket, you'll run into the 1k
> > > key limit. I'll save you some searching now ;)
> > > On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> wrote:
> > > > Hi everyone.
> > > > I wish clean up one directory into s3. This directory have a lot of
> > > > images, but i don't want to delete image by image. So, when I try to
> > > > do something like:
On Mon, Apr 18, 2011 at 10:45 AM, Nic <nicolas.fedd...@gmail.com> wrote: > Does fog have a built-in iterator that I can use for this?
> On Apr 13, 12:00 pm, geemus <wbe...@engineyard.com> wrote: > > The cloud providers don't actually provide for nested directories. In > > the end they just have long keys that contain many '/' characters. As > > such you can probably limit the list down to stuff with the prefix > > option and then iterate over those.
> > On Apr 13, 8:17 am, Nic <nicolas.fedd...@gmail.com> wrote:
> > > Is there a way to access a nested directory so that you can iterate > > > through it? So if I have a directory 6 levels deep with 10 images in > > > it how would I get that directory that I want to iterate through?
> > > On Mar 2, 1:24 pm, John Vincent <lusis....@gmail.com> wrote:
> > > > As Wes said, there's not a uniform way to do that. You'll have to > > > > iterate the contents.
> > > > However, depending on the size of the bucket, you'll run into the 1k > > > > key limit. I'll save you some searching now ;)
> > > > On Wed, Mar 2, 2011 at 9:46 AM, alexgr007 <alexgr...@gmail.com> > wrote: > > > > > Hi everyone.
> > > > > I wish clean up one directory into s3. This directory have a lot of > > > > > images, but i don't want to delete image by image. So, when I try > to > > > > > do something like: