# overwriting a compressed file

**URL:** <https://forum.kx.com/t/overwriting-a-compressed-file/11804>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [August 23, 2018, 11:42pm UTC](https://forum.kx.com/t/overwriting-a-compressed-file/11804 "2018-08-23T23:42:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_bieber](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@david\_bieber](https://forum.kx.com/u/david_bieber)\
**Post date:** [August 23, 2018, 11:42pm UTC](https://forum.kx.com/t/overwriting-a-compressed-file/11804/1 "2018-08-23T23:42:00Z")

</div>

Hi Group,

I am encountering an access error when I try to overwrite a compressed file which I can find no work around.

For instance when trying to change an entry on a compressed file

`.z.zd:(17;2;6)`:tcompress set asc 10000000?100; `:tcompress set @[get `:tcompress;0;:;1000]`

I encounter an access error on a windows 7 box

`ERROR: test. OS reports: Access is denied.`

However if I try to append entries on a non compressed file I receive no errors

`\x .z.zd`:tfile set asc 10000000?100; .z.zd:(17;2;6)`:tfile set @[get `:tfile;0;:;1000]`

Equally if I choose a different file name to overwrite then I receive no error

`.z.zd:(17;2;6)`:tfile0 set asc 10000000?100; `:tfile1 set @[get `:tfile0;0;:;1000]`

Any ideas of how I might work around this?

Kind regards

David

---

<div class="post-metadata">

**Author:** ![charlie1](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@charlie1](https://forum.kx.com/u/charlie1)\
**Post date:** [August 24, 2018, 8:08am UTC](https://forum.kx.com/t/overwriting-a-compressed-file/11804/2 "2018-08-24T08:08:00Z")

</div>

it’s an unfortunate feature of windows - while a file is open it cannot be overwritten.

When reading compressed files, kdb+ keeps the file open.

Hence, I don’t know of another way other than choosing a different target name, and then rename afterwards.

hth,

Charlie
