Can't read SD entries normally


I have this code, it is meant to look at an SD card where photos are stored. When the camera is used, the code creates a directory and photo in the root directory with the folder being used to keep track of unsent photos. When a photo is selected, the code deletes the folder. This code worked in my last revision, but I copied and pasted this block into my new code and not it isn’t working. It opens the file path, enters the while loop, but then dir.openNextFile returns a false with no data, telling my code there arne’t any files. However, when I look at it from my computer, I can see 1.JPG and a folder named 1. I’ve been scratching my head a while and need a second pair of eyes.

//Populate photo name in memory and check for photo
boolean selectPhoto() { // If folder matches filename minus file extension
  File dir ="/");
  while (true) {
    File entry = dir.openNextFile();
    if (!entry) {
      console("Ran outta entries");
      unsentPhotos = false;
      sendingPhoto = false;
      return false;
    String fn =;
    if (entry.isDirectory()) {
      if (fn != "SYSTEM~1") {
        photoName = fn + ".JPG";
        totalPackets = round(entry.size() / 200);
        return true;