Getting file path of latest added file in a folder - Mac OS 10.9 As learned from google and sister stack sites, this is the working solution I've come up with for getting the path of latest added file in a folder. But this is not giving the accurate result. I'm using Mavericks (OS 10.9)

set myFolder to "/Users/lawsome/folder"
tell application "Finder" to set latestFile to the last item of (sort files of (POSIX file myFolder as alias) by creation date) as alias
            set latestpath to POSIX path of latestFile
set latestpath to POSIX path of latestFile


Finally, Jose Alban's answer in here@askdiff gives an accurate sorted list using the mdls terminal command. How can I get the file path of last entry in this list.

Or any way to get the desired path.
The AppleScript code looks as thought it's getting the creation date rather than the date added.  Finder and System Events don't store date added information in AppleScript.  If you were running Yosemite, you could have done it with AppleScriptObjC.  But, with Mavericks, the only avenue I can think of is by way of shell scripting.
Via bash script:
F=~/folder \
&amp;&amp; [[ -d &quot;$F&quot; ]] \
&amp;&amp; mdls -name kMDItemFSName -name kMDItemDateAdded -raw &quot;$F&quot;/* \
 | xargs -0 -I {} echo {} \
 | paste -sd&quot; \n&quot; - - \
 | sort \
 | tail -1 \
 | cut -f4- -d&quot; &quot; \
 | printf '%s\n' &quot;$F/$(cat)&quot;

From within an AppleScript:
AppleScript has the ability to execute shell commands using do shell script.  You can either run the whole command above using do shell script, which is probably what most people would do.  But, just for demonstration purposes, I'm going to mix it with a bit of AppleScripting too.
property text item delimiters : space

set myFolder to &quot;/Users/lawsome/folder&quot; -- Folder to be evaluated

-- Assemble shell command
set sh to the contents of {¬
    &quot;[[ -d&quot;, quoted form of myFolder, &quot;]]&quot;, &quot;&amp;&amp;&quot;, ¬
    &quot;mdls&quot;, &quot;-name kMDItemFSName&quot;, &quot;-name kMDItemDateAdded&quot;, ¬
    &quot;-raw&quot;, [quoted form of myFolder, &quot;/*&quot;], ¬
    &quot;|&quot;, &quot;xargs&quot;, &quot;-0 -I {} echo {}&quot;, ¬
    &quot;|&quot;, &quot;paste&quot;, &quot;-sd' \\n' - -&quot;, ¬
    &quot;|&quot;, &quot;sort&quot;} as text

do shell script sh -- run the bash command
set latestFileAddedToFolder to the last paragraph of the result
--&gt; e.g. 2018-08-13 08:02:52 +0000 Some File Name.txt

-- Split text up into date components and filename text
set [{yyyy, m, dd, HH, MM, SS, &quot;+&quot;, timezone}, filename] to ¬
    [words 1 thru 8, text 27 thru -1] of latestFileAddedToFolder

-- Construct AppleScript date object from date components
tell the (current date) to set ¬
    [dateAdded, year, its month, day, time] to ¬
    [it, yyyy, m, dd, hours * HH + minutes * MM + SS]

set pathToMostRecentlyAddedFile to myFolder &amp; &quot;/&quot; &amp; filename

return contents of {pathToMostRecentlyAddedFile, ¬
    &quot;was added to its containing folder&quot;, myFolder, ¬
    &quot;on&quot;, date string of dateAdded, ¬
    &quot;at&quot;, time string of dateAdded} as text