Finally managed to fix an annoying problem whereby Nextcloud was sometimes running twice on one of my machines, and had double-downloaded every file (but not uploaded them, so my desktop had two copies of everything but the server didn't, and the duplication only happened on one account). This used up 8GB of space!
I will blog about it at some point, but the root cause was Nextcloud was listed to launch twice at startup, although it only did maybe 10% of the time. (1/2)
The command I ran to remove the duplicates was:
find . -name '\.*\.~*' | xargs -d '\n' rm
The -d '\n' argument to xargs tells it to only use newlines to separate paths, otherwise it tries to use any whitespace and this breaks when you have paths with spaces in them.
@jmtd Good point, I'd forgotten about that (some of my server backup scripts use -delete).
@pwaring The easy no-brainer way to do that escape thing is:
find -print0 | xargs -0
This will also work on filenames with newlines in them which are valid on *nix but not common.
@diffrentcolours @pwaring At least with GNU f}nd the "-delete" operation may be easier:
find -name whatever-pattern -delete
Run first without -delete to make sure you have the right pattern for the name.