I spent quite a bit of time sorting this out so posting it here in case its useful to others.
For reasons that are too long for this post I wanted TVH to record files to a local drive (source directory) and then to move these files to a network drive (destination directory) overnight.
One of the great things about TVH is that you can use the API to tell it where you have moved the files to so that it can find them and continue to play them trough the TVH client or other clients like kodi.
What the script does -
# It looks for files in the source directory that haven't been modified for more than 1 min (i.e. recorded has completed)
# These files are then copied to the destination using rsync - (see below)
# If successful, the script updates TVH with the new file location using the API
# If this is successful the source file is deleted
# The script also has some other bits (locking, tidying up empty directories etc.)
A few points to aid understanding
* In TVH (Configuration - Recording - Digital Video Recorder Profiles) my recording system path is set to /storage/TVHRecordings/ and my format string is 'Recent/$t/$t$_e_$c_%F_%R$n.$x' Therefore TVH will put all the recordings in /storage/TVHRecordings/Recent/... (the source)
* You have to mount the network drive - in my case the network drive is mounted to /storage/TVHRecordings/Stored (the destination)
* A note about the source and destination. In my case both the source and destination are under the configured recording system path (/storage/TVHRecordings/). You don't have to do this but if you move the destination outside this path then the files will not be correctly grouped in some clients (e.g. kodi).
* rsync - Note in the script the destination is written to directly using the rsync protocol (rather than writing to the mounted share). You'll just have to trust me that the reference to rsync://#RsyncUsername#@#NetworkDrive#/TV actually ends up in the same place as /storage/TVHRecordings/Stored
* The reason for using rsync rather that the usual copy command is that rsync is pretty light on network resources and can handle interruptions (e.g. if your network storage reboots or network fails). It can also be bandwidth limited which might be important in some circumstances.
* You'll need to schedule the script to run periodically using crontab - I usually run it overnight but you could run it as often as you want within reason.
* I'm using a RPi3 for the TVH server so you might need to change the script to run on other systems. Also note that if you are running on LibreElec you'll need to install the network tools addon within kodi (this contains rsync)
Anyway, hope it helps - I've attached the script, feel free to comment / improve.