Skip to content

Instantly share code, notes, and snippets.

@joeperpetua
Created May 15, 2024 14:35
Show Gist options
  • Save joeperpetua/cd30a55ef710025feaccea8d635b057c to your computer and use it in GitHub Desktop.
Save joeperpetua/cd30a55ef710025feaccea8d635b057c to your computer and use it in GitHub Desktop.
Synology Drive Clear Recycle Bin

We can list shared folders in Drive with their respective ID:

root@NAS-BACKUP:~# synowebapi --exec api=SYNO.SynologyDrive.TeamFolders method=list version=1 | jq '.data.items[] | "ID: \(.file_id) / Name: \(.name)"'
"ID: 795719640889204739 / Name: photo"
"ID: 781590850416189441 / Name: Share update"
"ID: 766719452698944079 / Name: Test Andrea 2"

Then, we can run a recycle bin deletion of only a specified team folder:

root@NAS-BACKUP:~# synowebapi --exec api=SYNO.SynologyDrive.Trash method=empty path="id:766719452698944079"
{
   "data" : {
   "async_task_id" : "task-8"
   },
   "httpd_restart" : false,
   "success" : true
}

This can be done with the personal homes too, the home directory to delete will be determined by the user passed in the runner attribute:

root@NAS-BACKUP:~# synowebapi --exec api=SYNO.SynologyDrive.Trash method=empty path=/mydrive runner=joel
{
   "data" : {
   "async_task_id" : "task-9"
   },
   "httpd_restart" : false,
   "success" : true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment