Below codes can get 1 single file from AWS 3 but, what about a folder?
var _key:int=Account.lessons[dl_i].id;
var dest:String = Conf.Dir+_key;
var request:G
The javascript code below will count the files inside a "folder"; in fact, it will list objects sharing the same part of the name, as @Viccari pointed out there is no folder. As data.Contents will be an array containing details on "the files inside the folder", you would then "get the folder".
var bucket = 'the_bucket_name';
var path_to_folder = 'path/to/the/folder/';
var params= {Bucket: bucket, Delimiter: path_to_folder };
s3.listObjects(params, function (err, data) {
if (err) {
console.log('Could not load objects from S3', err);
} else {
console.log('Loaded ' + data.Contents.length + ' items from S3');
}
});
For more details, see
There is no such stuff as folders in Amazon S3. It is a "flat" file system. The closer you can get to folders is adding prefixes like foo/bar/filename.txt
to your file names.
Even though several S3 tools will show you stuff as if they were contained inside folders, this concept does not exist on S3.
Please see this related thread: Amazon s3 Folders Problem