0

My app creates folders in the shared storage (DCIM/ and Pictures/ directories), which I want to be able to rename afterwards.

I save the images using MediaStore, the folders are created automatically.

Android Q (and above) already takes care of creating the folders if they don’t exist. The example is hard-coded to output into the DCIM folder. If you need a sub-folder then append the sub-folder name as next:

final String relativeLocation = Environment.DIRECTORY_DCIM + File.separator + “YourSubforderName”;

https://stackoverflow.com/a/56990305/10226383

I just can't seem to figure out how to do it, is that even possible with scoped storage, do I need to use MediaStore or SAF?

I know before the change to scoped storage you could do it this way:

File oldfolder = new File("path of the old folder","old name");
File newfolder = new File("path of the new folder","new name");
oldfolder.renameTo(newfolder);

If someone could point me in the right direction I would be really grateful!

nitnatsnoK
  • 57
  • 2
  • 4

0 Answers0