The issue in detail
Code in a sub stack builds a list of folder names using regression (Code adapted from a handler published by Ken Ray some time ago):
Code: Select all
on GetListOfFolders whatFolder
   set the defaultFolder to whatFolder
   put whatFolder  & return after sListOfFolders
   put the folders into tDirList
   repeat with n = 2 to the number of lines of tDirList
      GetListOfFolders (whatFolder & "/" & (line n of tDirList))
   end repeat
end GetListOfFoldersNext another handler on the substack processes the list and adds details of certain file types to an array.
Code: Select all
function ReadRAWfileIFDdata pSelectedFolder
   ## The only function that is exposed to the application using this sub stack
   ##  Build an array of all the images in the folders/s
   put empty into sListOfFolders
   If there is a folder pSelectedFolder then
      ## Build a list of folders
      GetListOfFolders pSelectedFolder
      If the last char of sListOfFolders is cr then delete the last char of sLi
      repeat for each line tFolder in sListOfFolders
         put GetFileInformation (tFileInformationA, tFolder) into tFileInformationA
      end repeat
      put SortDataByCreationMinutes (tFileInformationA) into tImageFileDataA
      Return tImageFileDataA
   else
      answer "Invalid Folder path passed to EXIF reading sub-stack"
      Return "Error"
   end if
end ReadRAWfileIFDdata
Private function GetFileInformation @pFileInfoA, pFolder
   ##########################################################################
   #
   # Populates an array with information about the files stored in a folder 
   # and the first generation of child folders.
   #
   # pFileInfoA : Array of information, to which new information is added.
   # pFolder : the full path of the folder to be searched.
   ##########################################################################
   put the keys of pFileInfoA into tKeys
   put the number of lines of tKeys into tFileCounter
##******* The next line causes a problem ********##
   put files(pFolder,detailed) into tFiles
  
   repeat for each line tFile in tFiles
      --add one to tProgressCounter
      put item 1 of tFile into tFileName
      ## Filter out unwanted files by exiting loop and moving to next file
      If tFileName begins with "." then next repeat
      
      put GetFileExtn(tFileName) into tExtn
      If tExtn is "xmp" then next repeat
      
      -- Check that file is image file else next repeat
      if IsImageFile(tExtn) is False then next repeat
      
      ## process a valid image file 
      add one to tFileCounter
      put word 1 of tFileName into tNameAndExtn
      
      
      ## Read Meta data in two Tiff File tags from raw files
      ## Load the Raw File into a variable
      put pFolder & slash & tFileName into tNameRawFile
      
      ## Call handler chain that reads the specific Tiff File Tags
      ## Reads the tags in Image File Directory Zero of the image files
      put ReadIfdZeroTags (tNameRawFile,tExtn,sDelimiter) into tFileTagDataA
      /* Store the data decoded from the image file into the main array */
      repeat for each line tKey in the keys of tFileTagDataA
         put tFileTagDataA[tKey] into pFileInfoA[tFileCounter][tkey]
      end repeat
      
      put pFolder into pFileInfoA[tFileCounter]["Path"]
      
      put tFileName into pFileInfoA[tFileCounter]["FileName"]
      put GetFileExtn(tFileName) into pFileInfoA[tFileCounter]["extn"]
      put GetRootName(tFileName) into pFileInfoA[tFileCounter]["RootName"]
      
      put item 4 of tFile into tCreationSeconds
      put tCreationSeconds into pFileInfoA[tFileCounter]["CreationSeconds"] -- 1591869930
      
      put tFileTagDataA ["ByteCountJPEG"] into pFileInfoA[tFileCounter]["ByteCountJPEG"]
      put tFileTagDataA ["PtrToJPEG"]+1 into pFileInfoA[tFileCounter]["JPEGStartByte"]
      
      
      if tFileTagDataA ["ValidFileType"] then
         -- use the meta data read from the EXIF data
         put tFileTagDataA ["CaptureDate"] & sDelimiter & tFileTagDataA ["CaptureTime"] into pFileInfoA[tFileCounter]["DTG"]
         put tFileTagDataA ["CaptureDate"] into pFileInfoA[tFileCounter]["sqlDate"]
         put tFileTagDataA ["CaptureDate"] into pFileInfoA[tFileCounter]["NewFolderName"]  --! DUPLICATION
         put tFileTagDataA ["Orientation"] into pFileInfoA[tFileCounter]["Orientation"]
         put tFileTagDataA ["CaptureTime"] into pFileInfoA[tFileCounter]["CaptureTime"]
      else
         -- unable to read data from the file so use the filesystem data
         put GetDTG (tCreationSeconds, "DTG") into pFileInfoA[tFileCounter]["DTG"] -- YYYY-MM-DD-HHMMSS
         put GetDTG (tCreationSeconds, "txtDate") into pFileInfoA[tFileCounter]["txtDate"] -- Thursday, June 11, 2020
         put GetDTG (tCreationSeconds, "sqlDate") into pFileInfoA[tFileCounter]["sqlDate"] -- YYYY-MM-DD
         put GetDTG (tCreationSeconds, "NewFolderName") into pFileInfoA[tFileCounter]["NewFolderName"] -- YYYY-MM-DD
         --put GetDTG (tCreationSeconds, "HMS") into pFileInfoA[tFileCounter]["CaptureTime"] -- HH:MM:SS
      end if
      --put GetDTG (tCreationSeconds, "MINS") into pFileInfoA[tFileCounter]["Minutes"] -- Time in minutes of day
      
      --put (tCreationSeconds DIV 60) into pFileInfoA[tFileCounter]["CreationMinutes"]
      put ConvertDate (pFileInfoA[tFileCounter]["sqlDate"]) into pFileInfoA[tFileCounter]["DisplayDate"] -- DD/MM/YYYY
      
      # Note the examples assume that a hyphen is selected as the separator character
      put "Array count is : " & tFileCounter && " Folder : " & pFolder  & CR after field "debug" of card "DateStampAndCopyFiles" of stack "DropZoneRename"
   end repeat
   
   return pFileInfoA
end GetFileInformationCode: Select all
put files(pFolder,detailed) into tFilesScreen shot of a break point just after the files command. Note that tFiles is empty and the folder is named 2021-06-13 Screen shot of the folder 2021-06-13 as displayed in the Finder Stopping the debug run and attempting to save the stacks results in this error message: It appears that the failed command has killed all file operations in the IDE.
I am checking the contents of the folders to see if there is anything odd about them.
Any thoughts ?

