---
title: 'dav lock'
---
**`dav lock [-pc] <url>`**
Creates a lock on the resource specified by the *url*. The lock is an exclusive write lock with infinite depth.
If the resource is successfully locked, a lock token for this resource is printed to stdout. This lock token should be saved somewhere to unlock the resource eventually.
**`-p`** disable file name and path decryption if enabled
**`-c`** enable file name and path decryption
**`-T <seconds>`** specify the lock token timeout in seconds
### Example 1: lock resource and use the lock token
$ dav lock myserv/resource
opaquelocktoken:0454905e-f2ff-45c4-a3d7-5c4e4db5ce37
$ dav put -L opaquelocktoken:0454905e-f2ff-45c4-a3d7-5c4e4db5ce37 myserv/resource newfile
$ dav unlock -L opaquelocktoken:0454905e-f2ff-45c4-a3d7-5c4e4db5ce37 myserv/resource