So I’m writing a script to analyze a folder filled with files. Do a process and pull information about each file. The script works perfectly except when there is only 1 file in the folder i’m analyzing. Because my processing is all done inside of the repeats, when there is only 1 file available it skips over the repeat. It’s seems like a really simple fix, but I am stumped…
Here is my script simplified for troubleshooting.
--> Usually run this script as a folder action, but simplified for this purpose I'm trying to troubleshoot my repeat line. set added_items to choose folder --> Typically my input will be a folder with anywhere from 1 to 100 files in it. tell application "Finder" set file_list to every file of entire contents of added_items -->This is where it breaks down. If there are multiple files in the folder it runs perfectly. It there is only one file in the folder then it skips over the repeat. repeat with every_item in file_list --> Analyze each file in the folder, pull information, and do some other processing. display dialog (name of every_item as text) end repeat display dialog "- End Of Script -" end tell
Any help would be much appreciated. Thanks!