What SDK are you targeting and are you running on Android 11. Unfortunately Android 11 now imposes restrictions on ExternalStrage that weren't there before making it less useful. See the 'Grant access to a directory's contents' section here
Access documents and other files from shared storage (android.com)
I've been trying to get my head round the various permutations of file access with Android and target SDK versions and have become thoroughly confused with what did work, works now and will work in the future. As my apps will not go into the Play Store I just keep them targeted at SDK 28 and things just work!
As a test try targeting SDK 28 and see if it works.