Platinum Partner

Browse Windows File System And Get The Path

This will show a "Browse For Folder" dialog, which doesn't return the path to the folder (some of the folders are "special", and as such don't have a path). The second call returns the full path from the PIDL (an identifier for the chosen folder). This call will throw a COM error if a "special" folder is chosen, so be sure to wrap in a try/catch clause.

SHBrowseForFolder can be called with no args (), which will give you no dialog message.


from win32com.shell import shell

pidl,disp,imglist=shell.SHBrowseForFolder(0,None,"Please choose a directory. Thanks.")
fullpath=shell.SHGetPathFromIDList(pidl)
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}