Like many of us, I rely heavily on my phone — photos, downloads, documents, and a random mix of files I probably should’ve organized months ago. One day, I decided it was time to back everything up from my Redmi 9 Prime to my PC. I thought: “Easy. Just use PowerShell and Robocopy.”
That’s when reality hit me.
❌ The First Roadblock: MTP Isn’t a Real Drive
When you plug in an Android phone over USB, Windows shows it in This PC as:
Looks like a normal path, right? But try to script it and… nope.
MTP (Media Transfer Protocol) isn’t a normal file system, so neither PowerShell’s Get-ChildItem
nor robocopy
could see it.
I needed a different approach.
🔑 Enter ADB (Android Debug Bridge)
ADB is a developer tool from Google that lets your computer talk directly to your Android device. With it, I could copy files reliably and even automate backups.
Here’s how I set it up:
-
Downloaded Platform Tools and extracted to
C:\platform-tools
. -
Added that folder to my PATH.
-
Enabled Developer Options → USB Debugging on my Redmi.
-
Ran:
At first, it showed:
The phone was waiting for me to approve the connection. A quick tap on “Allow USB debugging” fixed it, and finally:
Success! 🎉
🛠️ Writing the PowerShell Script
Now I needed a script that would:
-
Copy all internal storage folders.
-
Copy external SD card storage (if present).
-
Log the status of each root folder as COMPLETE or FAILED.
Here’s the final version I came up with:
📋 Example Log Output
After running the script, the log looked like this:
That was exactly what I needed: a per-folder backup status I could trust.
🎯 Final Thoughts
Backing up an Android phone via USB isn’t as straightforward as copying from a hard drive, but with ADB and a bit of PowerShell, it’s totally doable.
This setup now gives me peace of mind - my Redmi’s internal and external storage are mirrored onto my PC with logs to prove it.