Display Automate's Standard Storage Folders

by Baz Cuda

Version 1 (July 14, 2019)

Download (103 downloads)

Lists the standard storage folders for this device.

The storage() function provides very useful access to several of the often-used folders on an Android device, such as DCIM and Download, etc.

We should never assume, for instance, that everyone's downloads go to /storage/emulated/0/Download/, nor even that that folder even exists on the device that our flow is running on.

For example, if Automate is running inside Samsung's Secure Folder sandbox, all the primary storage locations are typically at /storage/emulated/150/...

Ideally, storage() should always be used when referring to one of the supported folders in a block's path or file field:

storage("downloads", "myfile.txt")

...on a standard device will return "/storage/emulated/0/Download/myfile.txt" which achieves two things: Firstly, we're guaranteed to be using the user's designated downloads folder, which may be on an external SD card, not on internal storage; secondly, it saves us from, yet again, having to use the messy and ubiquitous...

path ++ "/" ++ filename


ps Note that storage("internal") can be used to obtain the current flow's flow number ! ....

split(storage("internal), "/")[-1]

This will return a different flow number on every device.

5.0 average rating from 2 reviews

5 stars
4 stars
3 stars
2 stars
1 star

Rate and review within the app in the Community section.