Error using webDAV Search

The issue you are facing: Getting the error Principal with name myFolder not found when using WebDAV Search.

Is this the first time you’ve seen this error? : Yes, but also the first time i try this function.

Steps to replicate it:

  1. Run the command
curl -u myUser:myPass '' -X SEARCH -u myUser:myPass -H "content-Type: text/xml" --data '<?xml version="1.0" encoding="UTF-8"?>
<d:searchrequest xmlns:d="DAV:" xmlns:oc="">

The output of your Nextcloud log in Admin > Logging:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="">
  <s:message>Principal with name myFolder not found</s:message>

The folder myFolder is, as I see, in the root of my Nextcloud. I don’t know if I need something more to add before it (as I added “files”).

My objective is to check if a file exists in the nextcloud. I’ve asked for this in this forum before, but I didn’t get any answer so I’m still stuck in this step (now I’m trying to check it using the webDav search).


After all I’ve found an easier way to check if a file exists:

if ( curl -o/dev/null -sfI "$url" ); then
  echo "URL exists"
  echo "URL does not exist"

To that curl command you can add the --user parameter if you need authentication.

I’ve found it here.

I’ve been searching for it a couple of days now and I’ve found it easy to resolve for a person with knowledge in this topic. Despite this I have not received an answer in any of the questions I have published in this forum, which leads me to think that this community is not very useful, at least for new users (who in principle will be the ones who need more help).