Select to view content in your preferred language

Search for a folder in the portal

06-10-2020 07:52 PM
New Contributor III


I'd like to check if a folder exists in the portal before I create it. I don't see the feature_type = 'folder' option.

Thank you in advance,


0 Kudos
1 Reply
Esri Contributor

You can user the folder property of a user. I've created an example, where I'm using my own user. I create a list with the titles of the folders, that I currently have in my content. If a folder with a given name is not found, it will be created

gis = GIS(portalURL, username, password)

me =
my_folders = (me.folders)

new_folder = 'my new folder'

folder_list = [i['title'] for i in my_folders]
if new_folder not in folder_list:

However, it is worth noting that create_folder does nothing, if the folder already exists.

Link to api-reference