If s3cmd is present without a .py extension, rename it to s3cmd.py.
Add this location to your system environment variables (Path).
Step 5: Verify Installation
Run:
s3cmd --version
If s3cmd does not execute correctly, open the s3cmd file and ensure the first two lines are:
#!C:\Python310\python.exe
#coding: utf-8 -
If necessary, run s3cmd using:
python C:\Python310\Scripts\s3cmd.py --version
Alternatively, create a s3cmd.bat file in the same directory as s3cmd.py with the following content:
@echo off
python C:\Python310\Scripts\s3cmd %*
Then, retry running:
s3cmd --version
2. Configure s3cmd
Run:
s3cmd --configure
You will be prompted to enter the following details:
Access Key: YOUR_ACCESS_KEY
Secret Key: YOUR_SECRET_KEY
Default Region: US
S3 Endpoint: HOST_NAME //Use the Hostname from the Details page.
DNS-style bucket+hostname: HOST_NAME //Use the Hostname from the Details page.
Encryption password: (press Enter to pass)
Path to GPG program: (press Enter to pass)
Use HTTPS protocol: No
HTTP Proxy server name: (press Enter to pass)
Test access with supplied credentials:
Test access with supplied credentials? [Y/n]: Y
If the connection is successful, you will see:
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)
Save settings:
Save settings? [y/N]: y
Your configuration will be saved at:
C:\Users\<Username>\AppData\Roaming\s3cmd.ini
3. Usage Examples
List Buckets
s3cmd ls
Create a Bucket
s3cmd mb s3://my-bucket-name
Delete an Empty Bucket
s3cmd rb s3://my-bucket-name
List Files in a Bucket
s3cmd ls s3://my-bucket-name
Upload a File to a Bucket
s3cmd put <local_file_path> s3://my-bucket-name/<remote_file_name>
Example:
s3cmd put C:\Users\Username\Desktop\files\mv-test.mp4 s3://test-bucket/upload_test.mp4
Upload a folder to a Bucket
s3cmd put --recursive <local_file_path> s3://my-bucket-name
Example:
s3cmd put --recursive C:\Users\Username\Desktop\files s3://test-bucket
Download a File from a Bucket
s3cmd get s3://my-bucket-name/<remote_file_name> <local_file_path>
Example:
s3cmd get s3://test-bucket/upload_test.mp4 C:\Users\Username\Desktop\mv_download.mp4
Delete a File
s3cmd del s3://my-bucket-name/<remote_file_name>
Batch Upload Files Example
s3cmd put C:\Users\Username\Desktop\video1.mp4 C:\Users\Username\Desktop\video2.mp4 C:\Users\Username\Desktop\video3.mp4 s3://test-bucket/