Does Finder have a problem correctly identifying the existence of filenames with leading zeros, or is this an AS problem?
Try this example:
Create a folder with a single file in it named "Picture 1" and leave the window open in Finder.
Then run this script:
set firstFiles to {"Pic 1", "Pic 01", "Pic 001", "Picture 1", "Picture 01", "Picture 001"}
tell application "Finder" to set source_folder to (folder of the front window) as text
repeat with i from 1 to count of firstFiles set this_item to item i of firstFiles set file_name to (source_folder & this_item) as text tell application "Finder" to set found_first to exists file file_name tell application "Finder" to display dialog file_name & tab & found_first end repeat
On my machine (PowerMac G4 dual 450 running OSX 10.4.11) I get:
Pic 1 found_first = false <== correct Pic 01 found_first = false <== correct Pic 001 found_first = false <== correct Picture 1 found_first = true <== correct Picture 01 found_first = true <== incorrect Picture 001 found_first = true <== incorrect
with only a single file in the folder.
Is there a better way to check for the existence of the exact file name without jumping through hoops?
BTW, this was part of a larger script that then failed to retrieve the file name for a nonexistant file that the script said existed.
TIA,
Jim |