I am trying to backup a directory from a phone over adb
.
When using the following command I get an archive which is corrupt:
adb exec-out "tar -czh /sdcard/DCIM" > backup.tar.gz
But with the following command the archive is correct:
adb exec-out "tar -ch /sdcard/DCIM | gzip" > backup.tar.gz
The two tar files are 48.8mB with a difference of about 200kB. The corrupt archive is smaller.
I am using adb
at the Windows command line. It is necessary to receive the output as compressed data to avoid newline conversions. Both commands should provide compressed data.
My question is specifically asking why these two commands which should be identical are producing a different result.
The phone is running LineageOS 14.1 and is connected to a computer running Windows 10.
stty raw
ordos2unix
. See details under ADB heading in my answer to https://android.stackexchange.com/a/208114/218526 – Irfan Latif May 16 '21 at 04:45adb exec-out
to avoid such problems? – Robert May 16 '21 at 10:08