0

I want to create files with different sizes on an Android device. The one approach I have already tried was to create dummy files using fsutil and push it to devices.

Is there any way to achieve similar result with a command inside adb shell?

Alex P.
  • 30,437
  • 17
  • 118
  • 169
Gaurav Verma
  • 54
  • 1
  • 3
  • 9

1 Answers1

0

Yes, you can do it using dd command. I am not pretty sure it's available in your device. It works fine in my device, you can give a try.

In your host which connects with your Android device, with adb debug turn on, using the following command to create dummy file.

adb shell 'dd if=/dev/zero of=/data/local/tmp/test.img bs=4k count=800'
# check the result
adb shell ls -l /data/local/tmp/test.img
-rw------- shell    shell     3276800 2017-06-21 17:33 test.img

The command above will get data from /dev/zero and output to /data/local/tmp/test.img (a public writable directory for Android device), adjust bs and count value in your situation.

alijandro
  • 11,627
  • 2
  • 58
  • 74