# How to delete a notefile before sync?

**URL:** <https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368>\
**Category:** Notecard API\
**Created:** [October 14, 2024, 5:13am UTC](https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368 "2024-10-14T05:13:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ujur007](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ujur007](https://discuss.blues.com/u/ujur007)\
**Post date:** [October 14, 2024, 5:13am UTC](https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368/1 "2024-10-14T05:13:13Z")

</div>

For my project, I am going to use notefiles (sensors.qo) and would like to sync as soon as they are added. But seems that sync is not that much fast for my case. It takes approx 5 mins on average to happen. My code adds these files every one minutes or so. And the file contains data from the same sensors always.  
What I would like to do is detele those old files and only keep the most recently added file. So that I get right data on my cloud dashboard.

What I tried so far is some request from notehub-api.

> **[note Requests - API Reference - Blues Developers](https://dev.blues.io/api-reference/notecard-api/note-requests/6-x-lts/)**
>
> The note requests enable the quick creation and management of Notes in Notefiles.

First,

```auto
{"req":"note.add","file":"sensors.qo","body":{ "temp":72.22 },"sync":true}
{"total":1}

```

Then,

```auto
{"req":"note.get","file":"sensors.qo","delete":true}

```

```auto
{"err":"no notes available {note-noexist}"}

```

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [October 14, 2024, 1:07pm UTC](https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368/2 "2024-10-14T13:07:34Z")

</div>

Hi @ujur007,

Make sure your Notecard is in `continuous` mode:

```auto
{
  "req": "hub.set",
  "mode": "continuous"
}

```

…and you’re using `"sync":true` (to immediately sync) and `"live":true` (to bypass saving the Notefile to flash) with your note.add request:

```auto
{
  "req": "note.add",
  "file": "sensors.qo",
  "body": { "temp": 72.22 },
  "sync": true,
  "live": true
}

```

That’s about as fast as you’ll be able to sync with Notehub, and it should only take seconds.

---

<div class="post-metadata">

**Author:** ![ujur007](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ujur007](https://discuss.blues.com/u/ujur007)\
**Post date:** [October 14, 2024, 4:34pm UTC](https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368/3 "2024-10-14T16:34:07Z")

</div>

Hi @RobLauer  
I did that but still there is no notes?

```auto
 {
  "req": "hub.set","mode": "continuous"
}
{}
 {
  "req": "note.add",
  "file": "sensors.qo",
  "body": { "temp": 72.22 },
  "sync": true,
  "live": true
}
{}
> {"req":"note.get","file":"sensors.qo","delete":true}
{"err":"no notes available {note-noexist}"}
```

---

<div class="post-metadata">

**Author:** ![ujur007](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ujur007](https://discuss.blues.com/u/ujur007)\
**Post date:** [October 14, 2024, 4:40pm UTC](https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368/4 "2024-10-14T16:40:03Z")

</div>

I see that now the sync is very fast so no need technically to delete the old files. Nevertheless, it would be nice to know. if there is a possibility to delete the file once added.

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [October 14, 2024, 7:39pm UTC](https://discuss.blues.com/t/how-to-delete-a-notefile-before-sync/2368/5 "2024-10-14T19:39:48Z")

</div>

Yeah, sorry I wasn’t initially clear. My instructions were to make it as fast as possible!

You can use the [file.delete API](https://dev.blues.io/api-reference/notecard-api/file-requests/latest/#file-delete) to delete Notefiles on the Notecard:

```auto
{"req":"file.delete","files":["sensors.qo"]}

```
