I need a program that lists all my directories on my storage. I'm running the code as an kivy apk on Android so i cant change the permissions of my code. I already tried:
dir = [x[0] for x in os.walk("/storage/")]
but everytime i try to list a directory i'm not allowed to read it just stops and doesn't list any more dirs although my apk has android permissions WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE.
EDIT: I now used
file_dir = [os.path.join(root,file) for root, dir, files in os.walk("/storage/") for file in files if os.path.splitext(file)[1].lower() in ('.jpg', '.jpeg', '.mp4')]
to skip all folders i can't access but appereantly i've got broken folders in my storage. Is there a way to skip the folders i can't read?
following code skips those files you cant access due perms
abs_file_paths=[os.path.join(root, file) for root, dir, files in os.walk(dir_to_extract) for file in files]