# Change report file folder

**URL:** <https://community.seqera.io/t/change-report-file-folder/1273>\
**Category:** Ask for help\
**Tags:** nextflow\
**Created:** [October 9, 2024, 1:53pm UTC](https://community.seqera.io/t/change-report-file-folder/1273 "2024-10-09T13:53:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poshi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/poshi/32/1126_2.png) [@Poshi](https://community.seqera.io/u/Poshi)\
**Post date:** [October 9, 2024, 1:53pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/1 "2024-10-09T13:53:32Z")

</div>

I want to enable reporting on a production pipeline, but I’d like to put the report files in a different folder to avoid cluttering the main folder with dozens of files that will be there only for reference purposes.  
I see that I can configure the `report.file` variable, but I only want to change the folder, not the filename itself. Is there any way to modify that folder?  
In case I have to inform a full path, including filename, then how could I get the default name? Docs say the default is `report-<timestamp>.html` , but if I write that into the code, I’m pretty sure I will get a literal `report-<timestamp>.html` instead of the expected `report-$timestamp.html` . How can I mimmick the default?

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [October 10, 2024, 12:41am UTC](https://community.seqera.io/t/change-report-file-folder/1273/2 "2024-10-10T00:41:59Z")

</div>

See my `nextflow.config` below:

```auto
report.enabled = true
report.file = "report-" + String.format('%tF-%<tH:%<tM', java.time.LocalDateTime.now()) + ".html"

```

After running `nextflow run hello` I got a report file named `report-2024-10-09-21:40.html`. You can change the `String.format` argument so that you have it the way you want. And, with that, you can easily attach a folder name so that your report will be stored somewhere else, for example:

```auto
report.file = "my_folder_name/report-" + String.format('%tF-%<tH:%<tM', java.time.LocalDateTime.now()) + ".html"

```

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 10, 2024, 2:23pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/3 "2024-10-10T14:23:49Z")

</div>

There’s an issue for it here: [Separate the store directory from the filename in the trace, dag, report, and timeline scopes · Issue #5364 · nextflow-io/nextflow · GitHub](https://github.com/nextflow-io/nextflow/issues/5364)  
but also just to add the default name also includes the session id I think too.

---

<div class="post-metadata">

**Author:** ![Poshi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/poshi/32/1126_2.png) [@Poshi](https://community.seqera.io/u/Poshi)\
**Post date:** [October 28, 2024, 10:25am UTC](https://community.seqera.io/t/change-report-file-folder/1273/4 "2024-10-28T10:25:31Z")

</div>

That sounds quite good, but now I can preview a small synchronization issue.  
If I use that approach to set up the names for the report, the trace and the DAG, all of them will have slightly different timestamps, as the `java.time.LocalDateTime.now()` will be called multiple times.  
Which is the proper place for me to put a variable that will store the result of a single call to `now()` so I can use in the other scopes?

The best solution would be to solve the issue created by @mahesh.binzerpanchal and only have to modify the folder name without having to re-generate the name manually.

There’s also the fact that we don’t know what will happen if the folder do not previously exist. Will it be created? Can the creation be automated in some way? Doesn’t seem user friendly to ask a user that uses the pipeline for the first time directly from the repository to have to create a set of folders prior to execution.

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [October 29, 2024, 8:58am UTC](https://community.seqera.io/t/change-report-file-folder/1273/5 "2024-10-29T08:58:19Z")

</div>

The folders are created automatically. There’s no need to create anything prior to running the pipeline.

---

<div class="post-metadata">

**Author:** ![Poshi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/poshi/32/1126_2.png) [@Poshi](https://community.seqera.io/u/Poshi)\
**Post date:** [November 12, 2024, 10:18am UTC](https://community.seqera.io/t/change-report-file-folder/1273/6 "2024-11-12T10:18:35Z")

</div>

So there’s no location to put that definition to avoid calling it multiple times? Also, that definition will match with the other files that go to the default folder? Or will they have different names due to different timestamps? 😕 @mribeirodantas

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [November 12, 2024, 2:22pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/7 "2024-11-12T14:22:13Z")

</div>

You could provide it as a command line argument. Something like

```Groovy
nextflow run main.nf --name_id 2024_Nov_12

```

And then adding `${params.name_id}` to your filenames, as shown in my first answer.

---

<div class="post-metadata">

**Author:** ![Poshi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/poshi/32/1126_2.png) [@Poshi](https://community.seqera.io/u/Poshi)\
**Post date:** [November 12, 2024, 3:18pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/8 "2024-11-12T15:18:43Z")

</div>

Well, with that idea I could just assign inside the pipeline a variable called `params.name_id` with the value of `now()`, and that could serve the purpose of “unified timestamp”. But it does not solve the issue of having the same timestamp as the default files.  
In other words, if I want to change the folder for the report but leave the trace file by default, report and trace files will have different timestamps and won’t be matched. To have the same timestamp in all the files, I will be forced to re-create all the filenames for all the possible files (report, trace, dag…) just because I need to change a single folder in one of them.

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [November 12, 2024, 4:16pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/9 "2024-11-12T16:16:51Z")

</div>

Unfortunately, for now, yes. That’s how I would imagine myself doing that.

**UPDATE** : For clarity. If you want to change the folder for one of these files, you just need to change the `file` of one of these files, e.g.  
`report.file = 'my_folder/report.html'`.

The reason you have to change the filenames of all of them is because **you want to have different filenames for all of them**.

---

<div class="post-metadata">

**Author:** ![Poshi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/poshi/32/1126_2.png) [@Poshi](https://community.seqera.io/u/Poshi)\
**Post date:** [November 14, 2024, 10:28am UTC](https://community.seqera.io/t/change-report-file-folder/1273/10 "2024-11-14T10:28:14Z")

</div>

Errr… no @mribeirodantas , I want to keep the default filenames of all of them and only change the folder. I do not want different filenames, I want the same filename that they originally had by default.  
In the case where I only want to change a single folder (e.g. for the report, like in your example), then I have no way to re-generate the same filename it had by default, so the timestamps that appear in the other files (dag, trace, timeline) will be different.  
The only difference I want between the different files is the prefix that says which type of report do we have (report, dag, trace, timeline), but not the timestamp. As I said, I want to keep the default filenames.

---

<div class="post-metadata">

**Author:** ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)\
**Post date:** [November 14, 2024, 12:46pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/11 "2024-11-14T12:46:49Z")

</div>

If I understood well, the default filenames for those in the default directory may have different timestamps compared to the one you want to store in a different folder. You want all of them to have the same timestamp, which implies changing the timestamps to match that in the new directory (whose timestamp you have control over). So, yes, you want to change all four filenames, as this is the only way one can do now.

Not ideal, but the team is working on the issue Mahesh brought and we should soon have a solution decoupling the path from the filename 🥳

---

<div class="post-metadata">

**Author:** ![Poshi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/poshi/32/1126_2.png) [@Poshi](https://community.seqera.io/u/Poshi)\
**Post date:** [November 14, 2024, 2:39pm UTC](https://community.seqera.io/t/change-report-file-folder/1273/12 "2024-11-14T14:39:10Z")

</div>

Yes, that’s it. I cannot get the timestamp used by the default filenames, so I have to create my own and that forces me to change all the other files. But it is not that I want to do that, I’m forced to do that to keep them in sync.

Let’s see if the issue the team is working on is resolved soon, as that is precisely the functionality I’m lacking :-/

Thanks!
