Instead of manually uploading files and which can be time-consuming if there are too many files.

I will be sharing the steps on how can you upload files to google cloud storage using bat file from any of your windows machines automatically using task scheduler in this post.


How To Upload Files To Google Cloud Storage Using Batch Script From Your Windows Machine?

Firstly, make sure your account have the access for the bucket created in Google Cloud Storage. Else, you can create a bucket first if you have not done so.

Next, you will need to download the Google SDK -You can download it directly from the Google site here – https://cloud.google.com/sdk . The installation of the SDK is straightforward and is a GUI installer.

This is the command for to upload any files from your local machine to google cloud storage. You can actually save as the .bat file using the command below into the notepad to run it as a script.

gsutil -m cp -R "Your local path" gs://your-bucket-name

Something like this for network shared folders or from the local drive:

gsutil -m cp -R “\\the-host-name\sharefolder” gs://overhere/test123

gsutil -m cp -R “E:\UploadFolder” gs://overhere/test456


How to download files from Google Cloud Storage to your local machine?

To download files from Google Cloud Storage, it will be the same gsutil command:

gsutil -m cp -R gs://your-bucket-name "your local path"