# gdarch
[](https://github.com/taross-f/gdarch/actions/workflows/ci.yml)
[](https://codecov.io/gh/taross-f/gdarch)
A CLI tool to archive Google Drive folders and replace them with compressed archives.
## Motivation
Google Drive storage space is often filled with large folders that are rarely accessed but need to be kept for reference or backup purposes. This tool helps you free up storage space by:
1. Automatically compressing such folders into high-compression archives
2. Replacing the original folders with their compressed versions
3. Maintaining the same folder structure and accessibility
This way, you can keep your important data while significantly reducing storage usage.
## Features
- Recursively downloads all files from a specified Google Drive folder
- Creates a high-compression tar.xz archive
- Uploads the archive to the parent folder
- Optionally deletes the original folder
## Installation
### From PyPI
```bash
pip install gdarch
```
### From Source
```bash
# Install Poetry (if not already installed)
curl -sSL https://install.python-poetry.org | python3 -
# Clone and install
git clone https://github.com/taross-f/gdarch.git
cd gdarch
poetry install
```
## Usage
1. Get OAuth2 credentials from Google Cloud Console:
- Visit [Google Cloud Console](https://console.cloud.google.com/)
- Create or select a project
- Go to APIs & Services > Credentials
- Create an OAuth 2.0 Client ID
- Download the credentials and save as `credentials.json`
2. Run the command:
```bash
# When installed from PyPI
gdarch --folder-id <TARGET_FOLDER_ID> --credentials credentials.json
# When installed from source (using Poetry)
poetry run gdarch --folder-id <TARGET_FOLDER_ID> --credentials credentials.json
# Archive and delete the original folder
gdarch --folder-id <TARGET_FOLDER_ID> --credentials credentials.json --delete-folder
# Specify a custom archive name
gdarch --folder-id <TARGET_FOLDER_ID> --archive-name my_archive.tar.xz --credentials credentials.json
```
### Options
- `--folder-id`: Google Drive folder ID to archive (required)
- `--credentials`: Path to OAuth2 credentials file (defaults to credentials.json)
- `--archive-name`: Name for the uploaded archive file (optional)
- `--delete-folder`: Delete the original folder after archiving (flag)
### Finding Folder ID
The folder ID is the last part of the Google Drive folder URL:
```
https://drive.google.com/drive/folders/1234567890abcdef
^^^^^^^^^^^^^^^^
This is your folder ID
```
## Development
```bash
# Install dependencies
poetry install
# Run tests
poetry run pytest
# Format code
poetry run black .
poetry run isort .
```
## How It Works
1. Authenticates with Google Drive using OAuth2
2. Recursively lists all files in the specified folder
3. Downloads files while streaming them directly into a tar.xz archive
4. Uploads the compressed archive to the parent folder
5. Optionally deletes the original folder
6. Cleans up temporary files
## License
MIT License
Raw data
{
"_id": null,
"home_page": "https://github.com/taross-f/gdarch",
"name": "gdarch",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "google-drive, archive, compression, backup, storage-management",
"author": "Taro Furuya",
"author_email": "taro.furuya@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d7/9c/bf789f64cc797d40c09c25ffd5636aa66849fe37757462cb2344ac6ec9ab/gdarch-0.1.0.tar.gz",
"platform": null,
"description": "# gdarch\n\n[](https://github.com/taross-f/gdarch/actions/workflows/ci.yml)\n[](https://codecov.io/gh/taross-f/gdarch)\n\nA CLI tool to archive Google Drive folders and replace them with compressed archives.\n\n## Motivation\n\nGoogle Drive storage space is often filled with large folders that are rarely accessed but need to be kept for reference or backup purposes. This tool helps you free up storage space by:\n\n1. Automatically compressing such folders into high-compression archives\n2. Replacing the original folders with their compressed versions\n3. Maintaining the same folder structure and accessibility\n\nThis way, you can keep your important data while significantly reducing storage usage.\n\n## Features\n\n- Recursively downloads all files from a specified Google Drive folder\n- Creates a high-compression tar.xz archive\n- Uploads the archive to the parent folder\n- Optionally deletes the original folder\n\n## Installation\n\n### From PyPI\n```bash\npip install gdarch\n```\n\n### From Source\n```bash\n# Install Poetry (if not already installed)\ncurl -sSL https://install.python-poetry.org | python3 -\n\n# Clone and install\ngit clone https://github.com/taross-f/gdarch.git\ncd gdarch\npoetry install\n```\n\n## Usage\n\n1. Get OAuth2 credentials from Google Cloud Console:\n - Visit [Google Cloud Console](https://console.cloud.google.com/)\n - Create or select a project\n - Go to APIs & Services > Credentials\n - Create an OAuth 2.0 Client ID\n - Download the credentials and save as `credentials.json`\n\n2. Run the command:\n\n```bash\n# When installed from PyPI\ngdarch --folder-id <TARGET_FOLDER_ID> --credentials credentials.json\n\n# When installed from source (using Poetry)\npoetry run gdarch --folder-id <TARGET_FOLDER_ID> --credentials credentials.json\n\n# Archive and delete the original folder\ngdarch --folder-id <TARGET_FOLDER_ID> --credentials credentials.json --delete-folder\n\n# Specify a custom archive name\ngdarch --folder-id <TARGET_FOLDER_ID> --archive-name my_archive.tar.xz --credentials credentials.json\n```\n\n### Options\n\n- `--folder-id`: Google Drive folder ID to archive (required)\n- `--credentials`: Path to OAuth2 credentials file (defaults to credentials.json)\n- `--archive-name`: Name for the uploaded archive file (optional)\n- `--delete-folder`: Delete the original folder after archiving (flag)\n\n### Finding Folder ID\n\nThe folder ID is the last part of the Google Drive folder URL:\n```\nhttps://drive.google.com/drive/folders/1234567890abcdef\n ^^^^^^^^^^^^^^^^\n This is your folder ID\n```\n\n## Development\n\n```bash\n# Install dependencies\npoetry install\n\n# Run tests\npoetry run pytest\n\n# Format code\npoetry run black .\npoetry run isort .\n```\n\n## How It Works\n\n1. Authenticates with Google Drive using OAuth2\n2. Recursively lists all files in the specified folder\n3. Downloads files while streaming them directly into a tar.xz archive\n4. Uploads the compressed archive to the parent folder\n5. Optionally deletes the original folder\n6. Cleans up temporary files\n\n## License\n\nMIT License\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI tool to archive a Google Drive folder and replace it with the archive. Helps to free up Google Drive storage space by compressing rarely accessed folders while keeping them accessible.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/taross-f/gdarch",
"Repository": "https://github.com/taross-f/gdarch"
},
"split_keywords": [
"google-drive",
" archive",
" compression",
" backup",
" storage-management"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "30958170b2966251c3b4b15f6967ddb8f868ab9116cc2467f9e7da5e32dd126c",
"md5": "26908d00100e6b506d05557a12588f3b",
"sha256": "efd7556ea0bd32c76645d290c870e3693f4e295057c7125b1d35e7c32e748053"
},
"downloads": -1,
"filename": "gdarch-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "26908d00100e6b506d05557a12588f3b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 7032,
"upload_time": "2025-02-08T14:16:59",
"upload_time_iso_8601": "2025-02-08T14:16:59.493014Z",
"url": "https://files.pythonhosted.org/packages/30/95/8170b2966251c3b4b15f6967ddb8f868ab9116cc2467f9e7da5e32dd126c/gdarch-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d79cbf789f64cc797d40c09c25ffd5636aa66849fe37757462cb2344ac6ec9ab",
"md5": "9610441e53f4db7acba38bdd762de7b4",
"sha256": "2a95a4ee0cf98d03dc51f84002ac67e90de9ab278d370e4eef0d84fbe858070a"
},
"downloads": -1,
"filename": "gdarch-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "9610441e53f4db7acba38bdd762de7b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 6358,
"upload_time": "2025-02-08T14:17:01",
"upload_time_iso_8601": "2025-02-08T14:17:01.394693Z",
"url": "https://files.pythonhosted.org/packages/d7/9c/bf789f64cc797d40c09c25ffd5636aa66849fe37757462cb2344ac6ec9ab/gdarch-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-08 14:17:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "taross-f",
"github_project": "gdarch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gdarch"
}