Skip to content

Create a blank prefix in S3 using PowerShell #295

Answered by ashishdhingra
swordfish291 asked this question in Q&A
Discussion options

You must be logged in to vote

@swordfish291 Could you point me to this feature in AWS CLI which allows you to create blank prefix? Are you talking about simply to create a folder with the specified prefix? I do not think that's possible with AWS Tools for PowerShell. You may try something like below using AWS SDK for .NET:

string folderPath = "my-folder/sub-folder/";  
  
PutObjectRequest request = new PutObjectRequest()  
{  
    BucketName = _bucketName,  
    Key = folderPath // <-- in S3 key represents a path  
};  
  
PutObjectResponse response = client.PutObject(request); 

The above code could be easily translated to PowerShell code.

Thanks,
Ashish

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ashishdhingra
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. module/powershell-cmdlets
2 participants