WinSCP with S3

Advertisement

angel@isj.es
Joined:
Posts:
1
Location:
Madrid

WinSCP with S3

Hello, I would like to know how I can get the list of buckets because I can connect with C#, but it doesn't let me upload, telling me "the bucket does not exist." However, with the same data from the program, I can do it perfectly. If you need more information, please let me know, and thank you in advance.

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,852
Location:
Prague, Czechia

Re: WinSCP with S3

As in the GUI, even in the .NET assembly, the buckets are presented as root-level folders.
See https://winscp.net/eng/docs/guide_amazon_s3#buckets
So listing the root folder will give you bucket names. E.g. in C#:
var buckets = session.ListDirectory("/").Files.Select(_ => _.Name);
That also means that to upload to the bucket, you need to use the bucket name in the target path:
session.PutFileToDirectory(@"C:\local\path\file.txt", "/bucket");

Reply with quote

Advertisement

You can post new topics in this forum