Function Repository Resource:

WebDAVProperties

Source Notebook

Fetch file and directory properties from a WebDAV server

Contributed by: Jon McLoone

ResourceFunction["WebDAVProperties"][url]

returns a Dataset of properties for the WebDAV resource located at URL.

Details and Options

Web Distributed Authoring and Versioning (WebDAV) is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers.
The properties returned are as follows:
"URL"the URL of a WebDAV resource
"ModificationDate"the last change date of the resource
"FileSize"number of bytes contained in resource. For directories this is the sum of the contents file sizes.
"Tag"an ID number
"ContentType"the MIME type of the resource; for folders, no "ContentType" is returned
ResourceFunction["WebDAVProperties"] accepts the same options as URLRead.
ResourceFunction["WebDAVProperties"] does not store the credentials you provide or transmit them anywhere except to the WebDAV server that you are querying.

Examples

Basic Examples (2) 

Find all the resources in a WebDAV folder. Note: The URL used in this example was generated temporarily as a demo by webdavserver.com; to test the function, visit http://www.webdavserver.com in a browser and use the new temporary URL that you are redirected to:

In[1]:=
files = ResourceFunction["WebDAVProperties"][
  "https://www.webdavserver.com/Useraa38549"]
Out[1]=

Find properties for a single WebDAV resource:

In[2]:=
ResourceFunction["WebDAVProperties"][files[[2, "URL"]]]
Out[2]=

Options (1) 

WebDAVProperties accepts the same options as URLRead. For example, you can provide Authentication information to prevent a password dialog from being presented unless the credentials are invalid:

In[3]:=
ResourceFunction[
 "WebDAVProperties"]["https://amoeba.wolfram.com/remote.php/dav/files/jonm/demo", Authentication -> <|"Username" -> "examplename", "Password" -> "examplepassword"|>]
Out[3]=

Applications (2) 

Fetch URLs of all files in a directory of a given type:

In[4]:=
files = ResourceFunction["WebDAVProperties"][
   "https://www.webdavserver.com/Useraa38549"][
  Select[(Lookup[#, "ContentType"] == "application/octet-stream") &], "URL"]
Out[4]=

Download those files:

In[5]:=
URLDownload /@ files
Out[5]=

Publisher

Jon McLoone

Version History

  • 1.0.0 – 22 February 2022

Related Resources

License Information