Apps Cannot delete a file in Android 11

I have an application that make photos into a subdirectory called "DesPictures" in Environment.DIRECTORY_DCIM public directory

Another application scan the "DesPictures" directory and delete the photos one by one.

In Android 10 the code is:
dir = new File (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + "/DesPictures");
File list[] = dir.listFiles();
if (list(i) != null) {
for (int i = 0; i < list.length; i++) {
list(i).delete(); //WORKS IN Android 10 but DOES NOT WORK IN Android 11

Can anybody help me, please, in order to delete each list in Android 11? Thank you