# 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](https://rclone.org/downloads/) harus terinstall dan ada di PATH - Go 1.20+ (untuk build dari source) ### Build dari Source ```bash 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 ```bash ./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) ```bash ./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 ```bash ./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 ```bash ./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 ```bash ./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`: ```bash ./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 ```bash # Cek status job tertentu ./drive-migrator status # List semua job (coming soon) ./drive-migrator list ``` ### 🛠️ Manual Remote Management (Opsional) Jika ingin membuat remote secara terpisah: ```bash # 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`: ```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 JPG - `Documents/**` - Semua file dalam folder Documents dan subfolder - `**/*.pdf` - Semua file PDF di semua level folder - `Photos/2023/**` - Semua file dalam folder Photos/2023 - `!important.txt` - Kecualikan file tertentu (gunakan --exclude) ## Troubleshooting ### Error: rclone not found ```bash # 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: ```bash 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: ```bash # Tutup semua instance drive-migrator yang berjalan pkill drive-migrator # Atau hapus lock file rm migration.db.lock ``` ### Debug Mode Untuk troubleshooting detail: ```bash ./drive-migrator migrate --debug --log-file debug.log [other-flags...] ``` ## Tips & Best Practices 1. **Test dengan folder kecil dulu**: Gunakan `--include "test-folder/**"` untuk test 2. **Gunakan service account untuk Google Drive**: Lebih stabil daripada OAuth 3. **Monitor log file**: Gunakan `tail -f migration.log` untuk monitoring real-time 4. **Backup tracking database**: File `migration.db` berisi history semua migrasi 5. **Resume otomatis**: Flag `--resume` akan skip file yang sudah ada di tujuan ## Kontribusi 1. Fork repository 2. Buat feature branch (`git checkout -b feature/amazing-feature`) 3. Commit changes (`git commit -m 'Add amazing feature'`) 4. Push ke branch (`git push origin feature/amazing-feature`) 5. Buat Pull Request ## License Distributed under the MIT License. See `LICENSE` for more information.