# How to change default save directory

**URL:** <https://mworks.discourse.group/t/how-to-change-default-save-directory/235>\
**Category:** Support\
**Created:** [March 28, 2019, 4:40pm UTC](https://mworks.discourse.group/t/how-to-change-default-save-directory/235 "2019-03-28T16:40:51Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [August 5, 2019, 3:46pm UTC](https://mworks.discourse.group/t/how-to-change-default-save-directory/235/7 "2019-08-05T15:46:43Z")

</div>

Hi Travis,

The current MWorks [nightly build](https://mworks.github.io/downloads/) includes several new features that, while different from what I initially envisioned, should enable the sort of data-file management you want. Here’s what’s new:

1. Data files can now be created at fully arbitrary paths.

2. MWorks experiments can now include a [data file device](https://mworks.github.io/documentation/latest/components/data_file.html).

3. MWorks’ expression parser now includes a [date function](https://mworks.github.io/documentation/latest/expressions/index.html#other), which returns a date/time string in a user-specified format.

While there’s a lot of new functionality here, the usage is pretty simple. If you want to create a new data file for each run of an experiment, on a particular volume, organized by subject and protocol, with a time stamp, you can do so by including a single line in your experiment file, something like:

```
data_file ("/Volumes/exp_data/travis/$subject/$protocol/$(date('%Y%m%d-%H%M%S'))")

```

where `subject` and `protocol` are variables in your experiment. Equivalently, in XML:

```
<iodevice type="data_file" filename="/Volumes/exp_data/travis/$subject/$protocol/$(date('%Y%m%d-%H%M%S'))" />

```

Doing so gives you full control over how your data files are named and where they’re stored, and also eliminates the need for whoever’s running the experiment to manually open a data file at the start of each run.

Hopefully, these changes will meet your needs. If you have any questions or other feedback, please let me know!

Cheers,  
Chris

---

_[View the full topic](https://mworks.discourse.group/t/how-to-change-default-save-directory/235)._
