# Save selected files to a selected path keeping the original name

**URL:** <https://forum.inductiveautomation.com/t/save-selected-files-to-a-selected-path-keeping-the-original-name/68787>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [January 19, 2023, 1:03pm UTC](https://forum.inductiveautomation.com/t/save-selected-files-to-a-selected-path-keeping-the-original-name/68787 "2023-01-19T13:03:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 20, 2023, 4:46pm UTC](https://forum.inductiveautomation.com/t/save-selected-files-to-a-selected-path-keeping-the-original-name/68787/3 "2023-01-20T16:46:30Z")

</div>

There's no `system.file.saveDirectory` function, so choosing a directory to save to gets a bit complicated.  
Once you have the directory, you should be able to use `system.file.writeFile` with a generated directory + filename path, and `system.file.readFileAsBytes` to read the source file(s), as needed.

Choosing a directory with a GUI would look something like this:

```auto
from javax.swing import JFileChooser

fileChooser = JFileChooser()
fileChooser.fileSelectionMode = JFileChooser.DIRECTORIES_ONLY
result = fileChooser.showSaveDialog(None)
if result == JFileChooser.APPROVE_OPTION:
    directoryPath = fileChooser.selectedFile.path 

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/save-selected-files-to-a-selected-path-keeping-the-original-name/68787)._
