GCP Learner
GCP Learner

Reputation: 1

Is there a way to upload files from FTP to GCS using Google Cloud Client Library?

I am new to GCP and its client libraries. I am unable to upload files into google cloud storage bucket from FTP server using C++ Google cloud client library. When I tried to run the file "storage_object_file_transfer_samples.cc"(which is provided in google-cloud-cpp and link for the file is here ) as an executable, it threw an error. Error is "Standard exception raised: cannot open upload file source". Does GCP support connection with an external FTP server? If it does support the connection, how can we upload files from FTP server to GCS with C++ Client library?

Upvotes: 0

Views: 865

Answers (1)

rustyx
rustyx

Reputation: 85481

Does GCP support connection with an external FTP server?

This is explained in documentation, Client::UploadFile supports only regular filesystem files:

UploadFile()

Uploads a file to an object.

Note: Only regular files are supported. If you need to upload the results of reading a device, Named Pipe, FIFO, or other type of file system object that is not a regular file then WriteObject() is probably a better alternative.

So no FTP.

Use a third-party library like libcurl to download from FTP and client.WriteObject() to stream it to GCP.

Upvotes: 3

Related Questions