Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get a list of all the documents in the Recent Data folder

Message 1 of 3
356 Views, 2 Replies

Get a list of all the documents in the Recent Data folder

How do you get a list of all the documents in the Recent Data folder using a python Add-In?

I tried to find a way of getting the time saved of all the documents and then from there I could find out which ones are in the recent data folder. But I couldn't find a way of doing this in the API.

This code gets all the saved documents:

all_documents = [file for project in 
                 for file in project.rootFolder.dataFiles]

But I'm not sure how to get the time saved for each document.


Labels (1)
Message 2 of 3
in reply to: bevis.hobbs21

Here's some code that I believe will do it.  I didn't test it with a lot of projects or files but it seemed to work on my smaller dataset.


Because you can have folders many levels deep, it uses a recursive function to get all of the folders.  It gets every file and then sorts them based on the date of the latest version.


from datetime import datetime

def sortFunc(fileData):
    return fileData['date']

def GetFileListByDate(): 
    app = adsk.core.Application.get()
    files = []    
    for project in
        recurseFolders(project.rootFolder, files)

    files.sort(key=sortFunc, reverse=True) 
    for file in files:
        print('{} - {} - {}'.format(file['file'], file['project'], datetime.utcfromtimestamp(file['date']).strftime('%Y/%m/%d %H:%M:%S')))

def recurseFolders(folder, files):
    # Get the files in this folder:
    for file in folder.dataFiles:
        if file.fileExtension == 'f3d' or file.fileExtension == 'f3z':
            lastFile = file.latestVersion
            files.append({'file':, 'project':, 'date': file.dateCreated})

    # Iterate over the folders in this folder.
    for subFolder in folder.dataFolders:
        recurseFolders(subFolder, files)
Brian Ekins
Inventor and Fusion 360 API Expert
Message 3 of 3
in reply to: BrianEkins

Thanks that's exactly what I wanted.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report