I have an app that should pick the folder with the oldest modification date, and moves it to a specified place. My problem is, when I test just this bit of code, it works OK every time on my computer. When my app actually runs on a different computer, this part to pick the oldest folder does not work… UNLESS I have the window of the source opened and I have changed the display to List and sort by Mod Date in the Finder. Then it works OK. If I do not have the Finder window sorted first, it just picks either random folders or the folder with the last name alphabetically. Am I doing something wrong, is this a bug, … ?
tell application "Finder"
--LETS PICK THE OLDEST MOD DATE FOLDER, SO FIRST IN FIRST OUT
set sortedFiles to every item of folder myWatchedFolder
set sortedFiles to (sort sortedFiles by modification date)
move last item of sortedFiles to myWorkingFolder
--or use get last item of sortedFiles --just to test
end tell
OS X 10.4.11, XCode v2.5
Servers Windows mounted via AFP