Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Months ago I asked Is there a program or some method to access recent Finder windows / places?

After asking that question I started using a utility called Fresh to watch recently changed files all over the system and access them in a popup menu:

enter image description here

I like this but would also like some way to use a script to grab paths to the recently changes files on the system. How can I monitor files and get a list of the ones which have recently changed?

share|improve this question
up vote 1 down vote accepted

I don't know how to see recently modified files, but recently opened files are stored in a hex format in This MacScripter thread contains a handler for getting just the paths of the files, but it stopped working in 10.8.

on datatoposix(x)
    set f to (open for access POSIX file ("/tmp/datatoposix.dat") with write permission)
         repeat with d in x
              set eof f to 0
              -- Write the data object to the file.
              write d's contents to f
              -- Reset the file mark to byte 21.
              read f from 21 for 0
              set POSIXpath to ""
                    -- Read the next 8 bytes as a string and get the characters' IDs.
                    set idList to id of (read f for 8 as string)
                    -- Finish when IDs 2 to 8 aren't the values for "path item".
                    if (idList does not end with {0, 0, 0, 1, 1, 0, 0}) then exit repeat
                    -- Get the byte length of the item's name from the first ID.
                    set len to beginning of idList
                    -- Read that number of bytes as UTF-8 and append the result to the POSIX path.
                    set POSIXpath to POSIXpath & ("/" & (read f for len as «class utf8»))
                    -- Advance the file mark past any padding.
                    read f for (4 - len mod 4) mod 4
              end repeat
              set d's contents to POSIXpath
         end repeat
    on error msg
         display dialog msg
    end try
    close access f
end datatoposix

tell application "System Events"
    tell property list file "~/Library/Preferences/"
        set l to property list item "RecentDocuments"'s property list item ¬
        "CustomListItems"'s property list items's property list item "Bookmark"'s value
    end tell
end tell

share|improve this answer
simply amazing. you're awesome at applescript. – cwd Oct 18 '11 at 4:40
Hey @Lri - what tools (script editors & debuggers) do you use when doing all your applescripting? I have a good toolbox for web dev but not applescript development. – cwd Nov 15 '11 at 20:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.