What is a locked file?
Occasionally you might have a file that doesn't sync properly, and subsequently can't be deleted or renamed. The file might give an error saying that it is 'locked'. This article describes the procedure for unlocking files.
Deleting locks from the database
Start by putting your Nextcloud instance into Maintenance mode.
- Access your database using phpMyAdmin.
- Truncate or empty the oc_file_locks.
- Alternatively run the following SQL code
DELETE FROM oc_file_locks WHERE 1
Now you can disable Maintenance mode, and all being well you will be able to delete and/or edit the locked file.
If you find that files are being regularly locked, you might want to stop file locking altogether. This is not recommended, and is only added here for information.
- Open the /config/config.php file for editing.
- Add the following line and Save the file.
'filelocking.enabled' => false,
Thanks for visiting.