#Is there force for resource.delete() on non-empty directories?

1 messages · Page 1 of 1 (latest)

olive grove
#
& curl.exe -k -X DELETE `
>     "https://server.corp:443/api/storage/volumes/2c425a44-b834-4a53-a815-41901681a659/files/alice_dir%2Fbob_dir" `
>     -H "accept: application/json" -H "authorization: Basic ZG9udHBvc3Q6Y3JlZGVudGlhbHMh"
{
  "error": {
    "message": "Directory not empty",
    "code": "131138"
  }

Couldn't see them from the docs or the library source...

Thanks peeps.

livid void
#

There is a "recurse" query parameter that you can use. It's equivalent to using rm -rf

olive grove
#

Thank you @livid void !

olive grove
#

Thanks @livid void . I made the fixes suggested to my PR for the examples and noticed I'd already used this in the example I wrote and forgot! 🙃

livid void
#

Thanks for making the changes! I'll take a look soon.

#

I saw that you used get_collection instead of find. That should be fine but there is one thing to note:
"Find" expects exactly one record to be returned that matches the query, if more/less are returned, an error is thrown by the library. On the other hand, get_collection doesn't have this check. So in your example, if multiple volumes match the query then operations will be done on all these volumes. It's fine if that's your intention with the example, just wanted to make sure you're aware