What is a locked file?

nextcloudOccasionally 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.

  1. Access your database using phpMyAdmin.
  2. Truncate or empty the oc_file_locks.
  3. 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.

 

Permanent option

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.

  1. Open the /config/config.php file for editing.
  2. Add the following line and Save the file.
'filelocking.enabled' => false,

 

Thanks for visiting.