6.9 KiB
6.9 KiB
drive-migrator
Cloud drive migration tools - Simple, powerful, and automated
Fitur
- Single Command Migration: Migrasi lengkap dalam satu perintah tanpa setup manual
- Auto Remote Creation: Otomatis membuat konfigurasi rclone remote jika belum ada
- Multi-Cloud Support: Google Drive, OneDrive, NextCloud, WebDAV, dan lainnya
- Progress Tracking: Menyimpan status migrasi dalam database lokal (BoltDB)
- Resume Capability: Melanjutkan migrasi yang terputus
- File Filtering: Filter file/folder dengan pola include/exclude
- Comprehensive Logging: Log ke file atau stdout dengan level debug
Instalasi
Prasyarat
- rclone harus terinstall dan ada di PATH
- Go 1.20+ (untuk build dari source)
Build dari Source
git clone https://github.com/cloudmigration/drive-migrator
cd drive-migrator
go build -buildvcs=false
Penggunaan
🚀 Single Command Migration (Recommended)
Migrasi lengkap tanpa perlu setup rclone manual:
Nextcloud → Google Drive
./drive-migrator migrate \
--source-name nextcloud_avt \
--source-type nextcloud \
--source-url "https://files.avt.data-center.id/remote.php/dav/files/username" \
--source-user "your-username" \
--source-pass "your-password" \
--dest-name gdrive_personal \
--dest-type gdrive \
--dest-sa-file "/path/to/service-account.json" \
--log-file migration.log
Google Drive → OneDrive (contoh)
./drive-migrator migrate \
--source-name gdrive_source \
--source-type gdrive \
--source-sa-file "/path/to/source-sa.json" \
--dest-name onedrive_dest \
--dest-type onedrive \
--dest-client-id "your-client-id" \
--dest-client-secret "your-client-secret" \
--include "Documents/**"
📁 Migrasi dengan Filter
Hanya file tertentu
./drive-migrator migrate \
--source-name nextcloud_avt \
--source-type nextcloud \
--source-url "https://files.avt.data-center.id/remote.php/dav/files/username" \
--source-user "username" \
--source-pass "password" \
--dest-name gdrive_personal \
--dest-type gdrive \
--dest-sa-file "/path/to/sa.json" \
--include "*.pdf" --include "*.docx" --include "*.xlsx"
Kecualikan folder tertentu
./drive-migrator migrate \
--source-name nextcloud_avt \
--source-type nextcloud \
--source-url "https://files.avt.data-center.id/remote.php/dav/files/username" \
--source-user "username" \
--source-pass "password" \
--dest-name gdrive_personal \
--dest-type gdrive \
--dest-sa-file "/path/to/sa.json" \
--exclude "temp/**" --exclude "*.tmp" --exclude ".DS_Store"
Migrasi folder spesifik
./drive-migrator migrate \
--source-name nextcloud_avt \
--source-type nextcloud \
--source-url "https://files.avt.data-center.id/remote.php/dav/files/username" \
--source-user "username" \
--source-pass "password" \
--dest-name gdrive_personal \
--dest-type gdrive \
--dest-sa-file "/path/to/sa.json" \
--include "Documents/**" --include "Photos/**"
🔄 Resume Migrasi
Jika migrasi terputus, lanjutkan dengan flag --resume:
./drive-migrator migrate \
--source-name nextcloud_avt \
--source-type nextcloud \
--source-url "https://files.avt.data-center.id/remote.php/dav/files/username" \
--source-user "username" \
--source-pass "password" \
--dest-name gdrive_personal \
--dest-type gdrive \
--dest-sa-file "/path/to/sa.json" \
--resume
📊 Monitoring Status
# Cek status job tertentu
./drive-migrator status <job-id>
# List semua job (coming soon)
./drive-migrator list
🛠️ Manual Remote Management (Opsional)
Jika ingin membuat remote secara terpisah:
# Buat remote Nextcloud
./drive-migrator remote create \
--name nextcloud_avt \
--type nextcloud \
--url "https://files.avt.data-center.id/remote.php/dav/files/username" \
--user "username" \
--pass "password"
# Buat remote Google Drive
./drive-migrator remote create \
--name gdrive_personal \
--type gdrive \
--sa-file "/path/to/service-account.json"
# Lalu jalankan migrasi
./drive-migrator migrate --source-name nextcloud_avt --dest-name gdrive_personal
Supported Remote Types
| Type | Description | Required Flags |
|---|---|---|
nextcloud |
Nextcloud via WebDAV | --*-url, --*-user, --*-pass |
webdav |
Generic WebDAV | --*-url, optional: --*-user, --*-pass |
gdrive |
Google Drive | --*-sa-file (service account JSON) |
onedrive |
Microsoft OneDrive | --*-client-id, --*-client-secret |
Contoh Konfigurasi
Buat file ~/.drive-migrator.yaml:
debug: false
log-file: "/var/log/drive-migrator.log"
# Default excludes
default-excludes:
- "*.tmp"
- "*.temp"
- ".DS_Store"
- "Thumbs.db"
- "desktop.ini"
# Rclone additional options
rclone-options:
- "--transfers=4"
- "--checkers=8"
- "--retries=3"
- "--low-level-retries=10"
Pola Include/Exclude
Menggunakan sintaks glob pattern yang sama dengan rclone:
*.jpg- Semua file JPGDocuments/**- Semua file dalam folder Documents dan subfolder**/*.pdf- Semua file PDF di semua level folderPhotos/2023/**- Semua file dalam folder Photos/2023!important.txt- Kecualikan file tertentu (gunakan --exclude)
Troubleshooting
Error: rclone not found
# Windows
winget install Rclone.Rclone
# atau download dari https://rclone.org/downloads/
# Linux/macOS
curl https://rclone.org/install.sh | sudo bash
Error: service account file not found
Pastikan path ke service account JSON benar dan file dapat diakses:
ls -la /path/to/service-account.json
Error: failed to create remote
- Periksa URL, username, dan password
- Untuk Nextcloud, pastikan URL menggunakan format:
https://domain.com/remote.php/dav/files/username - Test koneksi manual:
curl -u username:password "https://domain.com/remote.php/dav/files/username"
Database locked
Jika tracking database terkunci:
# Tutup semua instance drive-migrator yang berjalan
pkill drive-migrator
# Atau hapus lock file
rm migration.db.lock
Debug Mode
Untuk troubleshooting detail:
./drive-migrator migrate --debug --log-file debug.log [other-flags...]
Tips & Best Practices
- Test dengan folder kecil dulu: Gunakan
--include "test-folder/**"untuk test - Gunakan service account untuk Google Drive: Lebih stabil daripada OAuth
- Monitor log file: Gunakan
tail -f migration.loguntuk monitoring real-time - Backup tracking database: File
migration.dbberisi history semua migrasi - Resume otomatis: Flag
--resumeakan skip file yang sudah ada di tujuan
Kontribusi
- Fork repository
- Buat feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push ke branch (
git push origin feature/amazing-feature) - Buat Pull Request
License
Distributed under the MIT License. See LICENSE for more information.