# Send and Delete

**URL:** https://forum.syncthing.net/t/send-and-delete/16272
**Category:** Feature
**Created:** [January 30, 2021, 1:49pm UTC](https://forum.syncthing.net/t/send-and-delete/16272 "2021-01-30T13:49:09Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![Arneko](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@Arneko](https://forum.syncthing.net/u/Arneko)
#### Post date: [July 14, 2022, 3:05am UTC](https://forum.syncthing.net/t/send-and-delete/16272/9 "2022-07-14T03:05:38Z")

</div>

If you find no other tool for this, I feel like you could (ab)use the “Trash Can Versioning” in syncthing.

Deletion on the originating device would need to be done manually after making sure the file is on the target device.

If you want to have more than one target device, I guess you could somehow share the trashcan folder itself…

Also, the solution people seem to envision here could easily be done if someone were to implement some form of this suggestion:

> [@Trigger script on event](https://forum.syncthing.net/t/trigger-script-on-event/13275):
>
> Hi, couldnt find anything regarding this - but could there be a feature to trigger a script on an event? F.ex. like when a new file is added to transfer queue, or when a file transfer is complete. For my part, i would like to send, with some info regarding the file in a notification on f.ex. mqtt/mail/something when a new file is in the queue and when its complete. /Chris

Which is a far more general approach and is more likely to get support from from the main devs, and indeed has been discussed on github

> <https://github.com/syncthing/syncthing/issues/5601>
>
> Configurable commands or scripts to run at various point in a file life cycle.
> …
> First: \*\*You did a great job! Thanks a lot!\*\*
> 
> \# Feature-Request: Pre and Post commands What does it means?
> 
> !\[Layout\_syncthing\](https://user-images.githubusercontent.com/9293951/54473498-deeb9580-47d8-11e9-8de5-0c46d8812cd2.png)
> 
> 
> \## Why?
> \- Encrypt data
> \- Notify users
> \- check for requirements
> \- ...
> 
> \## Pull
> 
> \- Global \*\*Pre-Pull-\*\*-Command
> - Runs \_before\_ \*\*downloading\*\* the sync
> - runs for \*\*each\*\* share not overwritting it
> - label:
> - %share-path%
> - %remote-device-id%
> - %local-device-id%
> - ...
> 
> \- Share \*\*Pre-Pull-\*\*-Command
> - Runs \_before\_ \*\*downloading\*\* the sync
> - \*\*only\*\* a single share
> - label like Global
> 
> \- Global \*\*Pull-File\*\*-Command
> - only at download
> - run it on each single file
> - runing on every share (if not overwritten in the share-setting)
> 
> \- Share \*\*Pull-File\*\*-Command
> - only at download
> - run it on each single file
> - runing only on a single share (overwrittes global-setting)
> 
> \- Global Post-Pull-Command
> - Runs \_after\_ \*\*downloading\*\* the sync
> - runing on every share (if not overwritten in the share-setting)
> - runs for \*\*each\*\* share not overwritting it
> - label like Global-Pre-Pull
> 
> \- Share \*\*Post-Pull-\*\*-Command
> - Runs \_after\_ \*\*downloading\*\* the sync
> - \*\*only\*\* a single share
> - label like Global-Pre-Pull
> 
> 
> \## Push
> 
> \- Global \*\*Post-Push-\*\*-Command
> - Runs \_before\_ \*\*uploading\*\* the sync
> - runs for \*\*each\*\* share not overwritting it
> - label:
> - %share-path%
> - %remote-device-id%
> - %local-device-id%
> - ...
> 
> \- Share \*\*Pre-Push-\*\*-Command
> - Runs before \*\*uploading\*\* the sync
> - \*\*only\*\* a single share
> - label like Global
> 
> \- Global / Share \*\*Push-File\*\*-Command
> - only at upload
> - run it on each single file
> - runing on every share
> 
> \- Global Post-Push-Command
> - Runs \_after\_ \*\*uploading\*\* the sync
> - runing on every share (if not overwritten in the share-setting)
> - runs for \*\*each\*\* share not overwritting it
> - label like Global-Pre-Pull
> 
> \- Share \*\*Post-Push-\*\*-Command
> - Runs \_after\_ \*\*uploading\*\* the sync
> - \*\*only\*\* a single share
> - label like Global-Pre-Pull
> 
> 
> 
> \## By default show global setting in share tab
> \- if values is changed, take the changed value and copy all others
> - important, as you do not know, whats is happening in the single shares if changing global settings
> - global setting can also used by set the value to \`\<global\>\`
> - setting a value to "\` \`" (empty string) means to do nothing! Do not use global setting!
> 
> 
> \## For all:
> 
> \- some labels like "%filename%", "%input-file%" = input file, %output-file% = ouput file name, "%hash%", %size%" = file size input file, ...
> - For using as \`myScriptDoingThinks --filname "%filename%" --hash %hash% --size %size% --ouput %output-file%\`
> - the client will replace all "%...%" with its values
> - if for example %output-file% is not set, file "%input-file% will be uploaded, if it is set file %output-file%
> 
> \## Labels:
> 
> \- %additional-files% = if exist, push also files in each line \`\<filename\>.sha3\\n\<filename\>.meta\`
> \- %filename% = filename no path
> \- %input-file% = filename read with absolute path
> \- %output-file% = filename write with absolute path (if not exist use %input-file%)
> \- %size% = file size input
> \- %hash% = hash of the block
> \- %device-id-local% = client id
> \- %device-id-remote% = id of extern partner(s)
> \- %email% = if support of user variables is insert so settings can take by the scripts like email
> \- %...%
> 
> 
> \## Exit codes
> 
> \- 0 = OK
> \- 1 = skip file
> \- 2 = about sync
> 
> \## Samples
> 
> \### Samples for \*\*Pre-Pull\*\*-Commands
> \- Mounting a device
> \- Checking for internet connection
> \- Checking for free space / existing file / ...
> \- Stopping a service using the shared files
> \- connect to vpn
> 
> \### Samples for \*\*Pull-File\*\*-Command
> \- Decrypt file
> \- check checksum of file
> \- unzip archivs
> \- unzip file
> \- run virus scan
> \- add data to a database, log, ...
> 
> \### Samples for \*\*Post-Pull\*\*-Commands
> \- check checksum of all file
> \- run virus scan
> \- send a notification to the user (popup)
> \- send a email notification
> \- disconnect from vpn
> \- run a deploy (e.g. copy to /var/www)
> \- run a backup
> 
> 
> \### Samples for \*\*Pre-Push\*\*-Commands
> \- generate checksum of all file
> \- Checking for internet connection
> \- connect to vpn
> 
> \### Samples for \*\*Pull-Push\*\*-Command
> \- Ecrypt file
> \- generate checksum of file
> \- zip file
> \- add data to a database, log, ...
> 
> \### Samples for \*\*Post-Push\*\*-Commands
> \- Unmounting a device
> \- disconnect to vpn
> \- Starting a service again using the shared files
> \- send a notification to the user (popup)
> \- send a email notification
> 
> \## Modifikation or addition version of \*\*File\*\*-Command
> - using pipes!
> - files is read by the client, gets piped to the command (Standard-Inputstream), doing things on the stream (read, modify, add) and outputs a pipe (Standard-Outputstream)
> \- Warning: input size may not equal output size (adding cipher header, ...)
> \- Example (Push):
> - \`encrypt-then-hash --hash %hash% --size %size% --device-id %device-id% -file-list %additional-files%\`
> 1. Opens file stream to local source file
> 2. Script
> 1. Compares stream matching %hash%
> 2. Encrypts stream and signing it with cert of %device-id%
> 3. Generate a sha3-hash of the stream
> 4. output stream
> 3. pipe stream data to extern partners
> 
> \## Final
> 
> Many information, some complexity but would to a design, where you can do crazy things.

---

_[View the full topic](https://forum.syncthing.net/t/send-and-delete/16272)._
