0

I need to generate unique folder name to be created in an object storage. I don't care what the name will be, i just need to Ensure that it will be unique. I am using a python script with boto3 to create the folders and I need to run the script many different times. what is the best way to do that?

1 Answers1

1

The key part is not how you generate the name. It is that you attempt to create the name and handle the failure if it already exists. Do not check for existence. If the creation succeeds then you have a unique name and that name is not in use by any concurrent process.

Dan D.
  • 73,243
  • 15
  • 104
  • 123