# Select directory instead of file using system.file.saveFile

**URL:** <https://forum.inductiveautomation.com/t/select-directory-instead-of-file-using-system-file-savefile/10653>\
**Category:** General Discussion\
**Created:** [October 22, 2015, 6:16pm UTC](https://forum.inductiveautomation.com/t/select-directory-instead-of-file-using-system-file-savefile/10653 "2015-10-22T18:16:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven.elam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.elam/32/4797_2.png) [@steven.elam](https://forum.inductiveautomation.com/u/steven.elam)\
**Post date:** [October 22, 2015, 6:16pm UTC](https://forum.inductiveautomation.com/t/select-directory-instead-of-file-using-system-file-savefile/10653/1 "2015-10-22T18:16:03Z")

</div>

My application needs to prompt the user for a directory name. I would like to use system.file.saveFile(), or something like it, to open a browser which allows the user to select a directory/folder.

The problem is that saveFile() only wants to return file names. When you select a directory and press Save, the browser descends into that directory. The closest you can get is to type a non-existent name into the selection field. (Typing in an existing directory name again results in the browser descending into that directory.)

I’m using an old version of Ignition (v. 7.5.10). If there is something I have overlooked in this version or a way to do this in a newer version, please let me know. Thanks.

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [October 22, 2015, 7:52pm UTC](https://forum.inductiveautomation.com/t/select-directory-instead-of-file-using-system-file-savefile/10653/2 "2015-10-22T19:52:02Z")

</div>

Try this

```auto
from javax.swing import JFileChooser

chooser = JFileChooser()
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
chooser.setAcceptAllFileFilterUsed(False)
chooser.setDialogTitle("Select Folder")
if chooser.showOpenDialog(None) == JFileChooser.APPROVE_OPTION:
	print str(chooser.getSelectedFile())
```

---

<div class="post-metadata">

**Author:** ![steven.elam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.elam/32/4797_2.png) [@steven.elam](https://forum.inductiveautomation.com/u/steven.elam)\
**Post date:** [October 22, 2015, 10:20pm UTC](https://forum.inductiveautomation.com/t/select-directory-instead-of-file-using-system-file-savefile/10653/3 "2015-10-22T22:20:08Z")

</div>

Thank you! I had overlooked the Jython solution.
