Search code examples
androidmacosadb

Saving multiple screenshots with adb


I can save screenshots from an Android using adb exec-out screencap -p > ~/Desktop/screen.png. My problem with this is that it overwrites the last saved image when I take a new one. How can we save multiple images so that it saves the newest image with a number, or something, like screen-2.png?

I've looked around and am not seeing any answered questions on this particular issue, but if I missed it, please point me in that direction.

Thank you.


Solution

  • If you don't want to create a script as recommended in the comments, then

    adb exec-out screencap -p > $(mktemp -t screen)
    

    would be the closest using random names.