# Select Directory with TGFileDialog

**URL:** <https://root-forum.cern.ch/t/select-directory-with-tgfiledialog/20481>\
**Category:** ROOT\
**Created:** [January 22, 2016, 1:58pm UTC](https://root-forum.cern.ch/t/select-directory-with-tgfiledialog/20481 "2016-01-22T13:58:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FabianHinder](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/53a042/32.png) [@FabianHinder](https://root-forum.cern.ch/u/FabianHinder)\
**Post date:** [January 22, 2016, 1:58pm UTC](https://root-forum.cern.ch/t/select-directory-with-tgfiledialog/20481/1 "2016-01-22T13:58:53Z")

</div>

Dear ROOTers,

is there a way, to select a directory with the help of the class TGFileDialog?  
Usually, it’s possible to select a file or mutliple files. But I want to select a directory. I wasn’t successfull on finding a solution on this problem, so here my question:  
Is there a special filter which can be used? Or exists another class providing the function to get a directory?

Thanks for your help.

Fabian

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [January 22, 2016, 2:53pm UTC](https://root-forum.cern.ch/t/select-directory-with-tgfiledialog/20481/2 "2016-01-22T14:53:55Z")

</div>

Hi Fabian,

See [url=https://root-forum.cern.ch/t/gui-directory-dialog/17921/1 post[/url]

Cheers, Bertrand.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [February 18, 2021, 1:05pm UTC](https://root-forum.cern.ch/t/select-directory-with-tgfiledialog/20481/3 "2021-02-18T13:05:25Z")

</div>

See also a proposed patch: [TGFileDialog new option to open / save to a folder, instead of a file by ferdymercury · Pull Request #7237 · root-project/root · GitHub](https://github.com/root-project/root/pull/7237)

[EDIT] → It’s now in ROOT master 🙂
