Skip to content

A simple CLI tool to upload files to Google Drive, Mega and Cloudinary. Upload files directly from your terminal.

License

Notifications You must be signed in to change notification settings

Mr-Aaryan/upload-easy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Upload Easy

A simple CLI tool to upload files to Google Drive, Mega and Cloudinary. Upload files and folder directly from your terminal with ease.

Features

  • Upload files to Google Drive.
  • Upload files to Cloudinary.
  • Upload files to Mega.
  • Support for directory uploads (including subdirectories).
  • Simple and intuitive CLI interface.

Installation

  1. Install Go if you don't have it already. Download Go.
  2. Clone this repository:
    git clone https://github.com/Mr-Aaryan/upload-easy.git
    cd upload-easy
  3. Build and install the tool:
    go install
    Ensure the Go bin directory is in your PATH.

Usage

Upload a File

To upload a file, use the following command:

go run main.go --file "./upload/file.png" -g

Options

  • --file (required): Path to the file or directory to be uploaded.
  • -g (optional): Upload to Google Drive.
  • -c (optional): Upload to Cloudinary.
  • -m (optional): Upload to Mega.

Example:

go run main.go --file "./upload/file.png" -g

Upload Directories

To upload directories with their contents, use the following format:

go run main.go --file "./uploads"

This will upload the directory contents to the selected cloud service. All files in the directory and subdirectories will be processed.

Configuration

Before using the tool, set up your environment variables:

Google Drive

  1. Obtain credentials for Google Drive API by following this guide.
  2. Save the credentials JSON file as credentials.json in the project directory as ./googleutils/credentials.json.
  3. The ./googleutils/token.json file will be automatically created after a successful authentication.

Cloudinary

  1. Log in to your Cloudinary account and obtain your API key and secret.
  2. Set up the .env file with the following variables:
    CLOUDINARY_URL=cloudinary://<API_KEY>:<API_SECRET>@<CLOUD_NAME>

Mega

  1. Create a Mega account if you don't already have one.
  2. Add the following to your .env file:
    MEGA_EMAIL=<mega_email>
    MEGA_PASSWORD=<mega_password>

Folder Structure

UPLOAD-EASY/
├── cloudinaryutils/
│   └── cloudinary.go
├── connection/
│   ├── cloudinary.go
│   ├── google.go
│   └── mega.go
├── googleutils/
│   ├── credentials.json
│   ├── google.go
│   └── token.json
├── megautils/
│   └── mega.go
├── utils/
│   └── utils.go
├── .env
├── .gitignore
├── go.mod
├── go.sum
├── LICENSE
├── main.go
└── readme.md

Examples

./uploads = path to my file/folder. yours might be different

Upload to Google Drive

File

go run main.go --file "./upload/file.png" -g

Folder

go run main.go --file "./uploads" -g

Upload to Cloudinary

File

go run main.go --file "./upload/file.png" -c

Folder

go run main.go --file "./uploads" -c

Upload to Mega

File

go run main.go --file "./upload/file.png" -m

Folder

go run main.go --file "./uploads" -m

Prerequisites

  • Go 1.20+ installed.
  • Environment variables configured in .env.

Roadmap

  • Add support for more cloud storage services.
  • Implement parallel uploads.
  • Provide support for folder uploads.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A simple CLI tool to upload files to Google Drive, Mega and Cloudinary. Upload files directly from your terminal.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages