# Workflow or plugin for deleting files after download

**URL:** <https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972>\
**Category:** ℹ️ Support\
**Tags:** workflow\
**Created:** [May 12, 2022, 4:08pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972 "2022-05-12T16:08:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrearossi](https://help.nextcloud.com/letter_avatar/andrearossi/32/6_449c533f586939b6e5f246632a46421f.png) [@andrearossi](https://help.nextcloud.com/u/andrearossi)\
**Post date:** [May 12, 2022, 4:08pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/1 "2022-05-12T16:08:01Z")

</div>

Hello everyone, this is my first post, I hope to be in the right section 😀

Yesterday I installed Nextcloud on my Ubuntu Server 20.04, the process run smoothly and I have a working instance of this service.

For a project, I have to implement the following feature: delete an externally shared file AFTER it has been downloaded.

Browsing nextcloud docs i found out about Workflows, and I installed the app called Workflow external scripts (vers. 1.8) since it seems more flexible. Github with readme here: [GitHub - nextcloud/workflow\_script: Rule based processing of files through specified external scripts · GitHub](https://github.com/nextcloud/workflow_script#placeholders)

So I tried to create a flow that does something like:  
When File is accessed AND file system tag IS _sometag_ RUN script rm %n

This flow above does apparently nothing, so I tried with something easier to check:  
When File is renamed RUN script touch /tmp/test.txt

Still nothing happens…  
I tried to check logs in nextcloud/data/nextcloud.log, but keeping it open with tail -f i see no new lines.  
Browsing the web for answers or helps i found this thread [Using Workflow External script to generate searchable PDF](https://help.nextcloud.com/t/using-workflow-external-script-to-generate-searchable-pdf/94785)

I also tried to create an helper bash script like that but still no luck.

Can I have some working example of some simple workflow? Would be super cool if someone knows if the deleting file after download can be feasible in this way.

Thanks

---

<div class="post-metadata">

**Author:** ![anon75456558](https://help.nextcloud.com/letter_avatar/anon75456558/32/6_449c533f586939b6e5f246632a46421f.png) [@anon75456558](https://help.nextcloud.com/u/anon75456558)\
**Post date:** [May 12, 2022, 4:17pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/2 "2022-05-12T16:17:53Z")

</div>

Here is a long-time feature request:

> <https://github.com/nextcloud/server/issues/6841>
>
> Sometimes you want to offer a download to a recipient, but have it work only onc…e. An expiration date then doesn't do the trick.
> 
> Why would you want this?
> \* Let the recipient download the file/folder but remove the share after they got it. Expiration date only works if you know when they will get the file. This way you don't have to clean up share link.
> \* Make sure the recipient and ONLY the recipient can download: sent link, check if person downloaded, link has disappeared already. Safe!

> [@andrearossi](#):
>
> Still nothing happens…

Did you check the documentation? There is also github.

[https://docs.nextcloud.com/server/latest/developer\_manual/digging\_deeper/flow.html](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/flow.html)

---

<div class="post-metadata">

**Author:** ![szaimen](https://help.nextcloud.com/user_avatar/help.nextcloud.com/szaimen/32/63019_2.png) [@szaimen](https://help.nextcloud.com/u/szaimen)\
**Post date:** [May 12, 2022, 4:59pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/3 "2022-05-12T16:59:58Z")

</div>

Why not use the downloadlimit app for this?

[https://apps.nextcloud.com/apps/files\_downloadlimit](https://apps.nextcloud.com/apps/files_downloadlimit)

---

<div class="post-metadata">

**Author:** ![andrearossi](https://help.nextcloud.com/letter_avatar/andrearossi/32/6_449c533f586939b6e5f246632a46421f.png) [@andrearossi](https://help.nextcloud.com/u/andrearossi)\
**Post date:** [May 13, 2022, 9:10am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/4 "2022-05-13T09:10:09Z")

</div>

Hey thanks, it works 😀

Well actually it does not delete the file from nextcloud, but I think I still should be ok with this. The most important thing was to have a one time download.

@anon75456558 That feature request has not been implemented, correct? Yes I read that documentation page, but being honest, I still have no clue on how write a working workflow. The Info there seems much different on what I see in the flow panel (at [http://my-nextcloud.com/index.php/settings/admin/workflow](http://my-nextcloud.com/index.php/settings/admin/workflow))

---

<div class="post-metadata">

**Author:** ![anon75456558](https://help.nextcloud.com/letter_avatar/anon75456558/32/6_449c533f586939b6e5f246632a46421f.png) [@anon75456558](https://help.nextcloud.com/u/anon75456558)\
**Post date:** [May 13, 2022, 4:11pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/5 "2022-05-13T16:11:36Z")

</div>

> [@andrearossi](#):
>
> Well actually it does not delete the file from nextcloud,

[You can try asking for help with your “share then delete” workflow on the community chat](https://cloud.nextcloud.com/call/xs25tz5y). Might be able to find more advice there.

You can also check out the retention app in case it can help you. [Here is the documentation](https://docs.nextcloud.com/server/stable/admin_manual/file_workflows/retention.html)

> **[Retention - Apps - App Store - Nextcloud](https://apps.nextcloud.com/apps/files_retention)**
>
> The Nextcloud App Store - Upload your apps and install new apps onto your Nextcloud

---

<div class="post-metadata">

**Author:** ![andrearossi](https://help.nextcloud.com/letter_avatar/andrearossi/32/6_449c533f586939b6e5f246632a46421f.png) [@andrearossi](https://help.nextcloud.com/u/andrearossi)\
**Post date:** [May 16, 2022, 2:59pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/6 "2022-05-16T14:59:33Z")

</div>

Yes, I’m using the retention app to have a “base” deleting mechanism.  
In this way if the shared file is downloaded, it will be automatically removed after x days, while the share link will instantly decay.  
Else, if nobody download the file, it still will be deleted after the retention period.

---

<div class="post-metadata">

**Author:** ![artlog1](https://help.nextcloud.com/user_avatar/help.nextcloud.com/artlog1/32/74918_2.png) [@artlog1](https://help.nextcloud.com/u/artlog1)\
**Post date:** [March 5, 2026, 7:04am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/7 "2026-03-05T07:04:42Z")

</div>

I actualy have the very same need for a security compliance request. This is to have a special incoming/outgoing system that won’t keep any file more than the required time to exchange them since those are confidential.

Still struggling with download, i don’t see how to trigger in workflow an action once a file is fully downloaded.  
I use downloadlimit so the share link disapears, but i would like the file itself to be deleted and didn’t find yet a way to do it.  
At least it it could be tagged as uploaded and then use retention to remove it. But i don’t see how to tag it on download.  
Can we even be sure that download actualy did complete on the server side ? In facts even if is not possible, having a delay between download notification by external link and removal will be enough to answer to compliance request.

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_449c533f586939b6e5f246632a46421f.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [March 5, 2026, 8:52am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/8 "2026-03-05T08:52:27Z")

</div>

> [@artlog1](#):
>
> Can we even be sure that download actualy did complete on the server side ? In facts even if is not possible, having a delay between download notification by external link and removal will be enough to answer to compliance request

Yes, you can combine a retention period set using the Retention app with a file download limit. Starting with NC 30, the latter can be set directly in the share settings, meaning the ‘File download limit’ app is no longer needed.

For example, you could set a one-week retention period in the Retention app and a download limit of `1` in the share settings, meaning the file would be deleted after a week, regardless of whether it was downloaded, and it could only be downloaded once during that period.

Alternatively, you may get away with simply letting the share expire after a given time instead of automatically deleting the file. Whether or not this is an option, of course, depends on your exact compliance policies. However, in most cases, it is probably more important that files cannot be downloaded multiple times and/or are not publicly available indefinitely than that they are deleted from Nextcloud.

---

<div class="post-metadata">

**Author:** ![artlog1](https://help.nextcloud.com/user_avatar/help.nextcloud.com/artlog1/32/74918_2.png) [@artlog1](https://help.nextcloud.com/u/artlog1)\
**Post date:** [March 5, 2026, 8:59am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/9 "2026-03-05T08:59:51Z")

</div>

Thanks for your extensive reply.

Unfortunately compliance is really about deleting file from filesystem, and to do it as soon as remote party get it. This has to be seen as a transfer, once it is transferred it should not remains on server.

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_449c533f586939b6e5f246632a46421f.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [March 5, 2026, 9:20am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/10 "2026-03-05T09:20:49Z")

</div>

In this case, it might be easiest to use a dedicated app. After all, if the files need to be deleted after transfer, there isn’t much advantage in using Nextcloud for that. A simpler, dedicated tool designed specifically for this purpose might be a better choice.

I can’t provide a recommendation, but I did a quick search and found the following app that might be worth a look: [https://github.com/Forcem/Gokapi](https://github.com/Forcem/Gokapi).

I’m pretty sure there are many more like it out there if you search online for ‘self-hostable WeTransfer alternative’ or a similar term.

---

<div class="post-metadata">

**Author:** ![artlog1](https://help.nextcloud.com/user_avatar/help.nextcloud.com/artlog1/32/74918_2.png) [@artlog1](https://help.nextcloud.com/u/artlog1)\
**Post date:** [March 5, 2026, 9:28am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/11 "2026-03-05T09:28:46Z")

</div>

Thanks, I will study your solution, this is valuable.

---

<div class="post-metadata">

**Author:** ![artlog1](https://help.nextcloud.com/user_avatar/help.nextcloud.com/artlog1/32/74918_2.png) [@artlog1](https://help.nextcloud.com/u/artlog1)\
**Post date:** [March 5, 2026, 11:05am UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/12 "2026-03-05T11:05:24Z")

</div>

i currently went to an alternative called lufi on a yunohost system [YunoHost app store | Lufi](https://apps.yunohost.org/app/lufi) .

---

<div class="post-metadata">

**Author:** ![artlog1](https://help.nextcloud.com/user_avatar/help.nextcloud.com/artlog1/32/74918_2.png) [@artlog1](https://help.nextcloud.com/u/artlog1)\
**Post date:** [March 5, 2026, 5:49pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/13 "2026-03-05T17:49:58Z")

</div>

I am back on this subject since files can be huge and nextcloud seems more appropriate than lufi for this since lufi does encrypt and decrypt in browser memory.

I fought with run scripts and finally did disable server side encryption with a decrypt-all. It starts to work.

scripts are run through cron jobs so this is delayed, but it definitely seems doable.

i was hoping server side encryption just prevent file handling, not fully prevent event triggering, but …

> **[GitHub - nextcloud/workflow\_script: Rule based processing of files through specified...](https://github.com/nextcloud/workflow_script#placeholders)**
>
> Rule based processing of files through specified external scripts

this is clearly written in Limitations : This app does not work with either encryption method.

UPDATE ( had to, since can’t add 3 replies )

This does not work : workflow\_script ‘Consult’ is a **postTouch** event, while we would like a postRead, which does not exist, or at least a **read** that is issued at first open file on download.  
There does not seems to exist solutions with download triggers yet.

If a file is deleted after upload and a app or desktop synchronisation is setup, then file removal will trigger a new synchronisation actualy removing the file that just has been downloaded.

This scenario looks really outside the scope of what nextcloud offers even with advanced tools.

Please change my mind 😉

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [June 3, 2026, 5:50pm UTC](https://help.nextcloud.com/t/workflow-or-plugin-for-deleting-files-after-download/138972/14 "2026-06-03T17:50:04Z")

</div>

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