Skip to content

file-operation: Prevent recursion to speed up emptying trash

Ondrej Holy requested to merge wip/oholy/trash-recursion into master

Emptying trash within Nautilus is a bit slow in comparison to plain rm -r. On my system, it took about 3 min to empty the trash with a folder containing 600 000 files, which is not ideal as rm -r call took just a few seconds. I found that g_file_delete is implemented differently for locations provided by the trash backend. The trash backend prevents modifications of trashed content thus the delete operation is allowed only for the top-level files and folders. So it is not necessary to recursive delete all files as the permission denied error is returned anyway. Let's call g_file_delete only for top-level items, which reduces the time necessary for emptying trash from minutes to seconds...

Fixes: #1589 (closed)

Merge request reports