Sorry if this has been asked - super hard question to search for.

When in icon view in finder you can move files around in a folder and arrange them however you want. When you come back to the folder the file icons all remember their arrangement so this data must be stored somewhere, I'd guess just as and x and y value.

Where is this data stored and can it be accessed and/or manipulated?

I'm mostly just curious about how this works but I also think would be fun to try and write a game that just used file icons moving around in a folder as an interface.


2 Answers 2


I, too, have found this to be a "super hard question to search for". Fortunately, I have had some success.

I presume that in asking where the position data is stored, you are interested in getting the current data and possibly changing it to change the locations of some or all of the file icons in a folder.

Regardless of where it is actually stored (I agree that it's probably in .DS_Store), it's accessible through AppleScript.

The following demo script loops through all files in the given (hardcoded) folder and displays a list of the name, position, bounds, comment, and default application properties. (If the list is longer than your screen, it gets truncated. A scrollable list is not what I'm trying to illustrate here.) For my use, I wanted to change not only the position of the file icons but also the Comment data and the default application.

The position property is x and y values of the center of the icon while the bounds depends on the icon size and is the active area where you can click and be clicking on the icon.

Note that the default application, often set through the Get Info dialog, is not a Finder property, it's a System Events property.

I hope this helps.

tell application "Finder"
    set folderPath to POSIX file "/Users/[[UserID]]/Documents/[[myTargetFolder]]/"
    set fileList to every file in folder folderPath
    set resultText to ""
    repeat with thisFile in fileList
        set thisName to name of thisFile
        set thisPosition to position of thisFile
        set thisBounds to bounds of thisFile
        set thisComment to comment of thisFile
        -- Format the position property
        set formattedPosition to item 1 of thisPosition & ¬
                        ", " & item 2 of thisPosition
        -- Format the bounds property
        set formattedBounds to item 1 of thisBounds & ¬
                        ", " & item 2 of thisBounds & ¬
                        ", " & item 3 of thisBounds & ¬
                        ", " & item 4 of thisBounds
        set resultText to resultText & "Name: " & thisName & linefeed
        set resultText to resultText & "Position: " & formattedPosition & linefeed
        set resultText to resultText & "Bounds: " & formattedBounds & linefeed
        set resultText to resultText & "Comment: " & thisComment & linefeed

        tell application "System Events"
            set defaultApp to default application of (info for thisFile)
            set resultText to resultText & "Default Application: " & defaultApp & linefeed & linefeed
        end tell
    end repeat
end tell

-- Display the result in a dialog
display dialog resultText with title "File Info" buttons {"OK"} default button "OK" giving up after 30

I'm of the same opinion as @Gilby: The information you're interested in is contained in the hidden .DS_Store file. But as the file's contents and structure are proprietary to Apple, it seems likely that you'll get mostly opinions instead of an answer to your question. Even though some aspects of the .DS_Store have been confirmed, there's no guarantee that they will remain unchanged. The best sources of information on this file may be in the .DS_Store Wikipedia article; some of the External links listed may give you some ideas or inspiration for the roving icon game you mentioned.

Another possibility is that some of the information of interest here is contained in the metadata squirreled away in the Apple File System (APFS) - another proprietary product from Apple.

And while I'm opining on Apple's proprietary software, I'll close with a passage found in my research for this answer: "open source accelerates that path to excellence". If so much of Apple's success is based on open source software, why do they eschew it now?


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .