Create a blank prefix in S3 using PowerShell #295
-
Hello team There is a way to create a blank prefix in S3 using cli but Write-S3Object cmdlet does not allow -Content to be blank. We can create a prefix but only if it contained an object and once that object gets deleted, the prefix get deleted along with it. Is there a way to create a blank prefix with PowerShell? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@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, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
@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:
The above code could be easily translated to PowerShell code.
Thanks,
Ashish