# Saving and retriving information to files inside a big for loop

**URL:** <https://discourse.julialang.org/t/saving-and-retriving-information-to-files-inside-a-big-for-loop/76783>\
**Category:** New to Julia\
**Created:** [February 20, 2022, 3:54am UTC](https://discourse.julialang.org/t/saving-and-retriving-information-to-files-inside-a-big-for-loop/76783 "2022-02-20T03:54:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luisgarciapuente](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luisgarciapuente/32/33989_2.png) [@luisgarciapuente](https://discourse.julialang.org/u/luisgarciapuente)\
**Post date:** [February 20, 2022, 3:54am UTC](https://discourse.julialang.org/t/saving-and-retriving-information-to-files-inside-a-big-for-loop/76783/1 "2022-02-20T03:54:18Z")

</div>

I have the following code running inside a loop that will run about 100 times but each iteration may take several hours.

open(string(“tree\_”, tree, “.txt”), “a”) do file  
println(file, (i, tree, model, length(sols), fibers(tree, model), nsols, npoints))  
end

Note: Not sure how to type here so that the tab on the second line displays.

Some of the computations have finished and I was expecting to see some of these files in the directory but so far no new files.

Question: Are the files going to be created until after the big for loop is done? Is there a way to retrieve somehow the files that are supposed to be there? I am afraid that the computation may crash at later stages or not finish for a long time, but I am interested in getting the data files that are supposed to be done.

Thank you very much for any help.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [February 20, 2022, 5:59am UTC](https://discourse.julialang.org/t/saving-and-retriving-information-to-files-inside-a-big-for-loop/76783/2 "2022-02-20T05:59:20Z")

</div>

Check with `pwd()` what your current directory is.

You can format code on discourse by enclosing it in a

````julia
```
triple backtick fence
```

````
