How to remove directory and files in /var/lib/syncthing?


In the /var/lib/syncthing folder, I had to delete a sync to set it up again with a different name. The first name used had a space in it which caused problems when backing it up to a NAS. How do I now get rid of the old folder name with space? I don’t have the rights to do this. I have tried via ssh with the sudo command. However, this does not work for folder names with a space in it. How do I get rid of these folders now? I do need the disk space they take up. Can anyone help me with this?

Thanks in advance!

Oke, sudo chmod -R 777 /var/lib/syncthing did the trick.

If synthing does not have an option to delete the folder then you could first stop and remove the syncthing job, and then remove the folder. If your folder was named, “My Folder With Spaces” you would do it like this:

ssh myuser@myfreedombox
cd /var/lib/syncthing
sudo rm -rf My\ Folder\ With\ Spaces

This will permanently delete the folder under /var/lib/syncthing and all of its files - make sure you don’t need anything there.

Filenames may contain spaces, but you have to use the ‘\’ “escape character” to tell your shell that the space character is part of the filename and not an additional argument. Try this in an empty directory…

$touch foo bar
$mkdir foo\ bar
bar foo ‘foo bar’
$rmdir foo bar
rmdir: failed to remove ‘foo’: Not a directory
rmdir: failed to remove ‘bar’: Not a directory
$rmdir foo\ bar
bar foo
$rm foo\ bar
rm: cannot remove ‘foo bar’: No such file or directory
$rm foo bar