This week I wanted to transfer my DVR files from one harddrive to another but had several terabytes of shows waiting to be deleted because of the 7 day limbo that files go into after being deleted. I started permanently deleting shows via the web interface under the /admin/recordings/files/deleted
path but there were over 800 of them and so I automated the process with a script. There's probably an easier way to do this but I couldn't figure it out. Here's the script I wrote:
#!/bin/bash
set -e
IDS=$(curl http://dvr.local:8089/dvr/files?all=true | jq '.[] | select(.DeleteScheduledFor != 604800000) | .ID')
for quoted_id in ${IDS//\n/ } ; do
id=$(echo $quoted_id | sed 's/"//g')
echo $id
curl -XPUT http://dvr.local:8089/dvr/files/$id/permanently_delete
sleep 10
done