I have
connection = Fog::Storage.new(fog_config)
bucket = connection.directories.get(bucket_name)
Is there a way (documented, non-documented, work-around) for me to create directories inside of this bucket? Something like:
sub_dir_for_user_1 = bucket.create_sub_dir('/user_1_files')
sub_dir_for_user_2 = bucket.create_sub_dir('/user_2_files')
In S3 zero byte files with a trailing slash will create a pseudo-directory. Which will cause folders to appear in the AWS Browser UI.
For fog passing nil into the body argument creates an empty file. So the following code would create a subdirectory...
bucket.files.create(
key: 'user_1_files/',
body: nil
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With