# Error deleting a Csv

**URL:** https://discourse.nodered.org/t/error-deleting-a-csv/32343
**Category:** General
**Created:** [2 September 2020 11:28 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343 "2020-09-02T11:28:51Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 11:28 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/1 "2020-09-02T11:28:51Z")

</div>

I have this error when I want to delete a csv through a timestamp, someone knows why it occurs .......

error:

Error: EPERM: operation not permitted, unlink 'C:/Users/rnb/Desktop/DatosCsvT03\Datos.csv' ![RR1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/156726b6a07edff254238b2c6db70c0639ad94c4.png) ![RR2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8aaa29f2b491493370e2a40ac58b4de01402472.png)

files are only deleted when i exit deply and log back in

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [2 September 2020 12:19 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/2 "2020-09-02T12:19:29Z")

</div>

Does the NR user have the authority to delete files from that folder?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [2 September 2020 12:23 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/3 "2020-09-02T12:23:32Z")

</div>

There is a mixture of `/` and `\` in there. For windows you may need to escape the `\` with another so `\\` - or just use `/` consistently

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [2 September 2020 12:31 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/4 "2020-09-02T12:31:25Z")

</div>

> [@osancleca](#):
>
> files are only deleted when i exit deply and log back in

In addition to the other comments, that sounds like something is holding onto the connection to the file so that you can't delete it. Do you have another flow that is writing to the file?

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 12:41 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/5 "2020-09-02T12:41:33Z")

</div>

Sorry, in one of the tests I changed it when copying and pasting, I have put it as it touches but it still does not work

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 12:44 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/6 "2020-09-02T12:44:31Z")

</div>

How can I know that?

my windows user has permission

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [2 September 2020 12:46 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/7 "2020-09-02T12:46:13Z")

</div>

Is your windows user the user running NR? (That's about all I can offer since I don't use windows)

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 12:48 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/8 "2020-09-02T12:48:27Z")

</div>

I have a previous flow that creates the file, once created it sends it by mail and once the mail is sent is when I try to delete the file.

 ![RR3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1e10c8ed9bd1610489b91da54b257c4cb25d1105.png)

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 12:49 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/9 "2020-09-02T12:49:25Z")

</div>

if in fact when I start the node network through cmd I do it as administrator

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 14:26 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/10 "2020-09-02T14:26:41Z")

</div>

It seems that you are right because if I disconnect the node and hit deploy again if it lets me delete the files, it seems that they remain open in the process and that is why it does not let me delete them automatically, I suppose that it can be forced to close the files with a node so I should let them delete them, any suggestions to be able to close them?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [2 September 2020 14:50 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/11 "2020-09-02T14:50:53Z")

</div>

In a previous thread I suggested, since you are only using the file for temporary storage, that you should consider using the built in persistent context feature to store the data rather than a file as it would probably be much simpler. This is yet another example of why it would be simpler using the context.

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [2 September 2020 15:53 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/12 "2020-09-02T15:53:14Z")

</div>

ok, I'll give it a spin

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [2 September 2020 20:13 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/13 "2020-09-02T20:13:26Z")

</div>

I think if you pass in the filename to the nodes you are using to write to the file rather than specify it in the config page then it should close after every write - as we have to assume you may change the filename for the next write - even if you don't - whereas if you fix the filename then we try to leave it open as it's faster performance wise for repeated writes.

---

<div class="post-metadata">

### Author: ![osancleca](https://avatars.discourse-cdn.com/v4/letter/o/ecccb3/32.png) [@osancleca](https://discourse.nodered.org/u/osancleca)
#### Post date: [4 September 2020 13:52 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/14 "2020-09-04T13:52:38Z")

</div>

funciona perfectamente, gracias por la ayuda.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [3 November 2020 13:52 UTC](https://discourse.nodered.org/t/error-deleting-a-csv/32343/15 "2020-11-03T13:52:41Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
