I'm using Python. I delete my files. They appear in trash.I have no idea how to delete them from trash.
import owncloud
oc = owncloud.Client('ip')
oc.login('account', 'password')
p=oc.list('/')
for i in p:
oc.delete(i.path) # and than they appear in trash
There's currently no official API for the trashbin app in ownCloud, and therefore it's not integrated in ownCloud's python library. However there's a couple of hacky ways to achieve what you need. Once the files are in the trashbin, you can use the app's ajax API to:
Remove all files from the trash
If you don't care about the contents of the trashbin at all and just want to delete them:
List and selectively remove the files you want:
You can request a list of the files in there:
Notice that the
dir
query parameter on the url can be the same you are using to list-delete all your files inp=oc.list('/')
.Response body will look like this:
Then you can create a list of the objects (
files
) you need to delete based on their names and mtimes:Last note:
<mtimeX>
in the request is the property"mtime": 1505373301000
of the file when requesting the list and removing the 3 trailing zeroes. Also be aware of constructing the name by joining the 2 parts with the.d
.Hope this helps!