Skip to content

Commit 5a36e2b

Browse files
committed
feat: updated with the go + ui
1 parent e7114d1 commit 5a36e2b

10 files changed

Lines changed: 2124 additions & 26 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

README-sh.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Android Backup and resume - a shell script
2+
3+
> Copy files and photos from android mobile to PC with option to resume if download breaks in between.
4+
5+
## Usage
6+
7+
### Install ADB (if not already installed):
8+
9+
- On Windows: Download the Android SDK Platform Tools and extract the ZIP file.
10+
- On macOS and Linux: Use a package manager (brew install android-platform-tools for macOS) or download and extract the Platform Tools ZIP file from the Android developer site.
11+
- https://developer.android.com/tools/releases/platform-tools
12+
13+
### Enable Developer Options on your Android device:
14+
15+
- Go to Settings > About phone.
16+
- Tap Build number multiple times until it says "You are now a developer!"
17+
- Go back to Settings > System > Developer options and enable USB Debugging.
18+
19+
### Connect the Device via USB:
20+
21+
- Use a USB cable to connect your device to the computer.
22+
23+
### Authorize the Device:
24+
25+
- When you plug the device into the computer, your Android device may prompt you to Allow USB debugging. Tap Allow.
26+
27+
28+
Run the ADB Shell
29+
```
30+
adb devices
31+
```
32+
Output:
33+
```
34+
List of devices attached
35+
RZXXXXXXXXX device
36+
```
37+
```
38+
adb shell
39+
```
40+
This should open the interactive shell.
41+
If all above stuff works, you are ready to start.
42+
43+
Run the shell script as follows:
44+
45+
- On windows open the git bash or MobaXterm (Windows paths might be different on both terminals)
46+
47+
```
48+
./backup.sh [-r remote_folder] [-l local_folder]
49+
e.g. ./backup.sh sdcard/DCIM/Camera /f/Photo/A52
50+
```
51+
> If download breaks, re-run the script with same parameters, script will resume from last download.

README.md

Lines changed: 133 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,158 @@
1-
# Android Backup and resume - a shell script
1+
# Android Backup
22

3-
> Copy files and photos from android mobile to PC with option to resume if download breaks in between.
3+
Copy photos and files from your Android device to your PC via a web interface — with folder browsing, pause/resume transfers, file management, and Wi-Fi ADB support.
44

5-
## Usage
5+
---
6+
7+
## Prerequisites
8+
9+
### 1. Go (1.21 or later)
10+
11+
Download and install from [go.dev/dl](https://go.dev/dl). Verify with:
12+
13+
```powershell
14+
go version
15+
```
616

7-
### Install ADB (if not already installed):
17+
### 2. ADB (Android Debug Bridge)
818

9-
- On Windows: Download the Android SDK Platform Tools and extract the ZIP file.
10-
- On macOS and Linux: Use a package manager (brew install android-platform-tools for macOS) or download and extract the Platform Tools ZIP file from the Android developer site.
11-
- https://developer.android.com/tools/releases/platform-tools
19+
Download **Android SDK Platform Tools** from [developer.android.com/tools/releases/platform-tools](https://developer.android.com/tools/releases/platform-tools), extract the ZIP, and add the folder to your `PATH`.
1220

13-
### Enable Developer Options on your Android device:
21+
Verify with:
1422

15-
- Go to Settings > About phone.
16-
- Tap Build number multiple times until it says "You are now a developer!"
17-
- Go back to Settings > System > Developer options and enable USB Debugging.
23+
```powershell
24+
adb version
25+
```
26+
27+
### 3. Enable USB Debugging on your Android device
28+
29+
1. Go to **Settings → About phone**
30+
2. Tap **Build number** 7 times until you see *"You are now a developer!"*
31+
3. Go to **Settings → System → Developer options**
32+
4. Enable **USB Debugging**
1833

19-
### Connect the Device via USB:
34+
---
2035

21-
- Use a USB cable to connect your device to the computer.
36+
## Build
2237

23-
### Authorize the Device:
38+
```powershell
39+
cd d:\projects\Software\AndroidBackup
40+
41+
# Download dependencies
42+
go mod tidy
43+
44+
# Build the binary
45+
go build -o androidbackup.exe .
46+
```
2447

25-
- When you plug the device into the computer, your Android device may prompt you to Allow USB debugging. Tap Allow.
48+
---
2649

50+
## Run
2751

28-
Run the ADB Shell
52+
```powershell
53+
.\androidbackup.exe
2954
```
55+
56+
Open your browser at **[http://localhost:8765](http://localhost:8765)**
57+
58+
To use a different port:
59+
60+
```powershell
61+
$env:PORT = "9000"; .\androidbackup.exe
62+
```
63+
64+
---
65+
66+
## Connect your Android device
67+
68+
### Option A — USB
69+
70+
1. Connect the device with a USB cable.
71+
2. When prompted on the phone, tap **Allow USB debugging**.
72+
3. Verify the device is detected:
73+
74+
```powershell
3075
adb devices
3176
```
32-
Output:
77+
78+
Expected output:
79+
3380
```
3481
List of devices attached
3582
RZXXXXXXXXX device
3683
```
84+
85+
### Option B — Wi-Fi
86+
87+
1. First connect via USB and run:
88+
89+
```powershell
90+
adb tcpip 5555
3791
```
38-
adb shell
39-
```
40-
This should open the interactive shell.
41-
If all above stuff works, you are ready to start.
4292

43-
Run the shell script as follows:
93+
2. Find your phone's IP address under **Settings → About phone → Status → IP address**.
94+
3. Disconnect the USB cable.
95+
4. In the web UI, enter the IP in the **Connect** field (e.g. `192.168.1.42`) and click **Connect**.
96+
97+
---
98+
99+
## Usage
100+
101+
| Step | Action |
102+
|---|---|
103+
| 1 | Open [http://localhost:8765](http://localhost:8765) |
104+
| 2 | Your connected devices appear in the left panel — click one to select it |
105+
| 3 | Browse the Android filesystem and navigate to the folder you want |
106+
| 4 | Click **← Use** to fill in the source path, or type it manually |
107+
| 5 | Click **Browse** next to the destination field to pick a local folder |
108+
| 6 | Click **Start Transfer** |
109+
| 7 | Monitor progress in the transfer queue — pause, resume, or cancel at any time |
110+
111+
### Resume an interrupted transfer
112+
113+
If a transfer stops (app closed, cable unplugged, etc.), reopen the app and click **Resume** on the paused transfer. Files already downloaded at their full size are skipped automatically.
114+
115+
### File management on device
44116

45-
- On windows open the git bash or MobaXterm (Windows paths might be different on both terminals)
117+
Hover over any file or folder in the Android browser to reveal **rename** and **delete** buttons.
118+
119+
---
120+
121+
## Transfer state
122+
123+
Transfer progress is saved to:
46124

47125
```
48-
./backup.sh [-r remote_folder] [-l local_folder]
49-
e.g. ./backup.sh sdcard/DCIM/Camera /f/Photo/A52
126+
%TEMP%\androidbackup_state.json
50127
```
51-
> If download breaks, re-run the script with same parameters, script will resume from last download.
128+
129+
This file is read on startup, so transfers survive app restarts and can always be resumed.
130+
131+
---
132+
133+
## API reference
134+
135+
The server exposes a REST API if you want to automate or script operations.
136+
137+
| Method | Path | Description |
138+
|---|---|---|
139+
| `GET` | `/api/devices` | List connected ADB devices |
140+
| `POST` | `/api/devices/connect` | Connect a Wi-Fi device `{"address":"192.168.1.x"}` |
141+
| `POST` | `/api/devices/disconnect` | Disconnect a Wi-Fi device |
142+
| `GET` | `/api/android/browse?serial=&path=` | List files/folders on device |
143+
| `POST` | `/api/android/delete` | Delete a file or folder on device |
144+
| `POST` | `/api/android/rename` | Rename or move a file on device |
145+
| `GET` | `/api/local/browse?path=` | Browse local filesystem |
146+
| `POST` | `/api/transfers` | Start a new transfer |
147+
| `GET` | `/api/transfers` | List all transfers |
148+
| `GET` | `/api/transfers/:id` | Get a specific transfer |
149+
| `POST` | `/api/transfers/:id/pause` | Pause a running transfer |
150+
| `POST` | `/api/transfers/:id/resume` | Resume a paused or failed transfer |
151+
| `POST` | `/api/transfers/:id/cancel` | Cancel a transfer |
152+
| `WS` | `/ws` | WebSocket stream for real-time progress events |
153+
154+
---
155+
156+
## Shell script (legacy)
157+
158+
The original Bash script is still available as `backup.sh`. See [README-sh.md](README-sh.md) for usage instructions.

0 commit comments

Comments
 (0)