I have a file on the sdcard which is being written to by an app constantly, I need to pull the file from the device as it is being written to by the app, onto my windows host machine for further analysis.

adb pull is no good as it pulls the whole file then stops, but of course the file is still being written too. And anyway the file gets very big so i don't want to copy the whole file each time, just the parts that have been written to since i last read it.

adb shell dd might be an option but i can only get it to copy from one file on the sdcard to another file on the sdcard, i.e. not my windows machine:

if i used dd and a pipe:: adb shell dd if=/sdcard/input.pcm > output.pcm the output file has some corruption: 0x0D, 0x0D is added randomly to the pcm data. Same as if I just do adb shell cat input.pcm.

I also thought about writing the data to logcat and parsing it, but this is rather clunky and messy and there is a ton of data.

Another option might be splitting the file up in to lots of small files as they are being written and then using adb pull.

None of these are ideal. Ideally i'd like a program on the host that can pull the data at my control, e.g fopen, fread, etc. But I am not sure if this is possible.

Can anyone suggest how I might be able to fulfill my requirements:

Read all the file that's available to windows host

Read the parts of the file that have been updated since i last did a read (e.g every 100ms)