# 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:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bastian\_Jara](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bastian\_Jara](https://forum.inductiveautomation.com/u/Bastian_Jara)\
**Post date:** [January 19, 2023, 1:03pm UTC](https://forum.inductiveautomation.com/t/save-selected-files-to-a-selected-path-keeping-the-original-name/68787/1 "2023-01-19T13:03:25Z")

</div>

hello everyone, I'm new here and I really can't find the solution or something that can guide me to do what I'm looking for...

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c4dabb38ad5ca3a25e1a835833837dc31020cdf3.png)

select files and paste in another direction, keeping the original name, ideally selected the location that I want to paste the files

for example,

old\_folder i have; file.py , contract.pdf , logo.img...

I want to select what I copy and where paste in  
new\_folder -\> file.py (if I selected it)

Is it too complex or am I just drowning in a glass of water?

---

<div class="post-metadata">

**Author:** ![Bastian\_Jara](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bastian\_Jara](https://forum.inductiveautomation.com/u/Bastian_Jara)\
**Post date:** [January 20, 2023, 1:00pm UTC](https://forum.inductiveautomation.com/t/save-selected-files-to-a-selected-path-keeping-the-original-name/68787/2 "2023-01-20T13:00:51Z")

</div>

any possible solution?

---

<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 

```
