| Crates.io | rustdrivesync |
| lib.rs | rustdrivesync |
| version | 1.1.1 |
| created_at | 2026-01-07 14:12:48.072566+00 |
| updated_at | 2026-01-07 15:50:19.361453+00 |
| description | Production-ready CLI tool for one-way file synchronization with Google Drive. Features: dependency injection, rate limiting, retry with backoff, parallel uploads, and comprehensive documentation. |
| homepage | https://github.com/chapzin/rustdrivesync |
| repository | https://github.com/chapzin/rustdrivesync |
| max_upload_size | |
| id | 2028313 |
| size | 342,628 |
Sincronização unidirecional de arquivos com Google Drive
RustDriveSync é uma ferramenta CLI desenvolvida em Rust para sincronização eficiente e confiável de arquivos locais com o Google Drive. Projetada para ser leve, rápida e segura.
cargo install rustdrivesync
git clone https://github.com/usuario/rustdrivesync
cd rustdrivesync
cargo build --release
O binário estará em target/release/rustdrivesync
Para usar o RustDriveSync, você precisa de credenciais OAuth 2.0 do Google. Siga este guia passo a passo:
Acesse o Google Cloud Console
Criar Novo Projeto
Acessar a API Library
Buscar e Habilitar
Google Drive API⚠️ Obrigatório antes de criar credenciais
Acessar OAuth Consent Screen
Configurar Tipo de Usuário
Preencher Informações Obrigatórias
Escopos (Scopes)
https://www.googleapis.com/auth/drive.fileTest Users (Usuários de Teste)
Revisar e Confirmar
Acessar Credentials
Criar Nova Credencial
Configurar Tipo de Aplicação
Baixar Credenciais
client_secret_XXXXX.jsoncredentials.json~/.config/rustdrivesync/)# Linux/macOS
mkdir -p ~/.config/rustdrivesync
mv ~/Downloads/client_secret_*.json ~/.config/rustdrivesync/credentials.json
chmod 600 ~/.config/rustdrivesync/credentials.json
# Windows (PowerShell)
New-Item -Path "$env:APPDATA\rustdrivesync" -ItemType Directory -Force
Move-Item "$env:USERPROFILE\Downloads\client_secret_*.json" "$env:APPDATA\rustdrivesync\credentials.json"
✅ Pronto! Você agora tem o arquivo credentials.json necessário.
Erro: "Access blocked: This app's request is invalid"
Erro: "The OAuth client was not found"
Arquivo credentials.json não baixa
rustdrivesync config --init
Isso criará um arquivo config.example.toml. Copie-o para config.toml e edite:
cp config.example.toml config.toml
vim config.toml
Configure pelo menos:
source.path: pasta local a sincronizargoogle_drive.credentials_file: caminho para credentials.jsongoogle_drive.target_folder_id ou target_folder_namerustdrivesync auth
Isso abrirá seu navegador para autorizar o aplicativo.
rustdrivesync sync --once
rustdrivesync sync --watch
rustdrivesync sync --dry-run
rustdrivesync status
# Arquivos pendentes
rustdrivesync list
# Arquivos no Google Drive
rustdrivesync list --remote
# Diferenças local vs remoto
rustdrivesync list --diff
Por padrão, o RustDriveSync preserva a estrutura de diretórios local no Google Drive.
Com preserve_folder_structure = true (padrão):
LOCAL GOOGLE DRIVE
/home/user/Documentos/ RustDriveSync/
├── projeto/ ├── projeto/
│ ├── arquivo1.txt → │ ├── arquivo1.txt
│ └── src/ │ └── src/
│ └── main.rs → │ └── main.rs
└── fotos/ └── fotos/
└── foto.jpg → └── foto.jpg
Com preserve_folder_structure = false (modo legado):
LOCAL GOOGLE DRIVE
/home/user/Documentos/ RustDriveSync/
├── projeto/ ├── arquivo1.txt
│ ├── arquivo1.txt → ├── main.rs
│ └── src/ └── foto.jpg
│ └── main.rs →
└── fotos/
└── foto.jpg →
No arquivo config.toml:
[sync]
preserve_folder_structure = true # Padrão: true
O RustDriveSync foi projetado para lidar com arquivos muito grandes (até 5 TB):
[sync]
max_file_size_mb = 10240 # 10 GB
chunk_size_mb = 32
max_concurrent_uploads = 2
Veja config.large-backups.toml para configuração completa e detalhada.
# Gerar documentação Rust
cargo doc --open
O RustDriveSync pode ser configurado para diferentes cenários:
| Perfil | Tamanho dos Arquivos | max_file_size_mb | chunk_size_mb | max_concurrent |
|---|---|---|---|---|
| 📄 Documentos | < 100 MB | 100 | 5 | 4-8 |
| 💾 Backups Médios | 100 MB - 1 GB | 1024 | 16 | 2-4 |
| 🗄️ Backups SQL Grandes | 6-8 GB | 10240 | 32 | 1-2 |
| 🎥 Vídeos | > 10 GB | 50000 | 64 | 1 |
Arquivos de exemplo:
config.example.toml - Configuração padrão para backups grandesconfig.large-backups.toml - Configuração otimizada para backups SQL (6-8 GB)config.toml (Backups Grandes):[general]
log_level = "info"
log_file = "./logs/rustdrivesync.log" # Monitorar progresso
[source]
path = "/var/backups/database" # Pasta de backups
recursive = true
ignore_hidden = false
ignore_patterns = ["*.tmp", "*.partial"]
[google_drive]
credentials_file = "./credentials.json"
token_file = "./token.json"
target_folder_id = "1ABC123xyz" # Ou use target_folder_name = "Backups-SQL"
[sync]
mode = "once" # Usar com cron/scheduler
conflict_resolution = "overwrite"
# CONFIGURAÇÃO PARA ARQUIVOS GRANDES (6-8 GB)
max_file_size_mb = 10240 # 10 GB (crítico!)
chunk_size_mb = 32 # Chunks maiores = mais eficiente
max_concurrent_uploads = 2 # Evita saturar conexão
verify_upload = true
preserve_folder_structure = true
[retry]
max_attempts = 5 # Mais tentativas para arquivos grandes
initial_delay_seconds = 2
max_delay_seconds = 120 # 2 minutos de delay máximo
Veja config.example.toml para todas as opções disponíveis.
┌─────────────────────────────────────────────────┐
│ RustDriveSync │
├─────────────────────────────────────────────────┤
│ │
│ CLI (clap) → Config → Core Engine │
│ │ │
│ ├─ File Scanner │
│ ├─ Sync Engine │
│ └─ State Manager │
│ │ │
│ ▼ │
│ Google Drive Client │
│ (OAuth2 + Upload) │
│ │
└─────────────────────────────────────────────────┘
cargo build
cargo test
cargo clippy
cargo fmt
Fundação:
Qualidade e Performance:
V1.1 (Q1 2026) - Melhorias de Segurança e Observabilidade:
V1.2 (Q2 2026) - Múltiplos Backends:
V2.0 (Q3-Q4 2026) - Sincronização Avançada:
V3.0 (2027) - Enterprise Features:
📋 Veja ROADMAP.md para detalhes completos sobre features planejadas, sprints, e debt técnica. 📄 Veja CHANGELOG.md para histórico detalhado de mudanças.
Contribuições são bem-vindas! Por favor:
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)Este projeto está licenciado sob a Licença MIT - veja o arquivo LICENSE para detalhes.
Desenvolvido com ❤️ em Rust