react-native-fs icon indicating copy to clipboard operation
react-native-fs copied to clipboard

RNFS.readDir(path) only returns folders in directory files are excluded

Open MianIbrarHussain opened this issue 1 year ago • 6 comments

I have been using different libraries but none of them is fetching files all of them only return folders. I am working on file manager app for which access to all files in storage is necessary. If anyone could tell me why react-native-fs or react-native-blob-util only return folders and not files in them? If anybody have any suggestions I am all ears.

MianIbrarHussain avatar Nov 07 '23 08:11 MianIbrarHussain

I also experienced the same issue when I used ExternalStorageDirectoryPath but DocumentDirectoryPath list all files and folders

Valentine-Mario avatar Nov 13 '23 16:11 Valentine-Mario

Same thing happening for me as well directory files are excluded

chinmay4github1987 avatar Mar 07 '24 06:03 chinmay4github1987

Same thing happening for me as well directory files are excluded

I also faced same issues but figured it was not the issue of RNFS.readDir function but due to change in the way permissions are handled from android 11(API level 30). Android 11 introduced scoped storage, which restricts access to external storage and requires apps to use the MediaStore API or the Storage Access Framework (SAF) for accessing files. So, from Android 11, the READ_EXTERNAL_STORAGE permission is not required for accessing media files. Instead, you should use the READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, or READ_MEDIA_AUDIO permissions, depending on the type of media you're accessing. Hope it helps, if it does then leave a thumbs up or if not then please mention the API level/Android version on which you are facing this issue then I will be able to help more.

arthurDz avatar Mar 15 '24 06:03 arthurDz

Same issue , has anyone find any solution ,

mean while i'm using MediaStore API

getsettalk avatar Jul 25 '24 16:07 getsettalk

Due to new policies you need to get special app access to read external storage for your app and you will be good to go...

On Thu, Jul 25, 2024, 21:11 Sujeet Kumar @.***> wrote:

Same issue , has anyone find any solution ,

mean while i'm using MediaStore API

— Reply to this email directly, view it on GitHub https://github.com/itinance/react-native-fs/issues/1208#issuecomment-2250840821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZOMJK2QUA4PQJXSDVL4H3TZOEPSLAVCNFSM6AAAAAA7AZOVZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJQHA2DAOBSGE . You are receiving this because you authored the thread.Message ID: @.***>

MianIbrarHussain avatar Jul 25 '24 16:07 MianIbrarHussain