# What can cause corrupt output files?

**URL:** <https://discourse.julialang.org/t/what-can-cause-corrupt-output-files/19300>\
**Category:** General Usage\
**Created:** [January 5, 2019, 9:14am UTC](https://discourse.julialang.org/t/what-can-cause-corrupt-output-files/19300 "2019-01-05T09:14:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Post date:** [January 5, 2019, 9:14am UTC](https://discourse.julialang.org/t/what-can-cause-corrupt-output-files/19300/1 "2019-01-05T09:14:00Z")

</div>

Recently, I was battling with corrupt output files. One of my routines prints out data to files with either println, or lately (when I was battling with the issue) with CSV.write. In both ways, I got corrupt files occasionally. Probably in 1 out of 20 files I create, part or whole lines are missing, or garbage appear on one line, or blocks of data are out of place.

I run Manjaro Linux via VirtualBox on MacBook Pro host. It looks (I am not positive) the corrupt files happen when they are written in VBox’s shared folders. I tried to write into VBox’s native folder and it appears OK so far.

I have been doing editing, copying and saving my source files to the shared folder for a long time and never run into any corrupted files. I wonder what can cause the file corruption when I write from a Julia routine. Any idea?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 5, 2019, 10:02am UTC](https://discourse.julialang.org/t/what-can-cause-corrupt-output-files/19300/2 "2019-01-05T10:02:01Z")

</div>

Not `close`ing files could in principle cause some missing output. But the first think I would look for is a bug in your code; remote filesystems either sync or not, but should not introduce corruption. You could test by writing to a local folder.

---

<div class="post-metadata">

**Author:** ![LeoK987](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leok987/32/4880_2.png) [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Post date:** [January 5, 2019, 10:16am UTC](https://discourse.julialang.org/t/what-can-cause-corrupt-output-files/19300/3 "2019-01-05T10:16:36Z")

</div>

Files are properly closed.  
I wrote 150 files to VBox’s native (local) drive, and they appear OK.
