adb forward tcp:7080 tcp:8080
# from another terminal on same machine (or run adb cmd directly)
adb shell 'tar --exclude=/data/media/0/TWRP -Jcvf - /data/media | nc -p 8080 -l 1>/dev/null'
# original terminal
nc -w15 localhost 7080 > media.tar.gz
adb forward --remove tcp:7080
There is no apparent way to transfer the content of the "SD card" between devices while preserving file times. This is problematic because many apps sort by file creation / modification time. Below is a method that uses rsync on rooted devices to accomplish this. It is possible to do this strictly on the phones, but it is significantly slower because of the wifi connection. Coping files to a host machine, then to a new device over USB is much faster than wifi.
We start an rsync server on the source device, use adb to forward it to a local port, then pull the contents onto our host. Then we switch devices and use the same technique to push back to the target device.
To start:
- Install ADB on your computer.
- Install rsyncdroid or SSHelper on both devices.
On the source device:
- Start rsyncdroid and change the configuration of the [sdcard] module to point to /data/media/ instead of /sdcard. (Required because of permission issues due to emulating a real SD card.)
- Click the "Start" button at the bottom.
- Connect to USB.
- ./adb forward tcp:10500 tcp:873
- sudo rsync -azv rsync://root@localhost:10500/sdcard/ sdcard/
- Disconnect when done.
On the target device:
- Start rsyncdroid and change the configuration of the [sdcard] module to point to /data/media/, and change read_only to no.
- Connect to USB.
- ./adb forward tcp:10500 tcp:873
- sudo rsync -azv sdcard/ rsync://root@localhost:10500/sdcard/
hmm, nice