Why does it take so long to delete in Lubuntu file explorer (PCManQt)?

Sep 29, 2024

I came across a Reddit post about deleting files taking so long on Ubuntu file explorer, Nautilus. That got me thinking. This stuff happened on my Linux workstation all the time. Anytime I try deleting a folder with a lot of files, this is what happens. I still want to see if it's true so I create a little experiment according to the post.

The experiment

Using this command, the machine creates 30000 empty files in a folder of my choosing, let's call it delete.

for name in $(seq 30000); do touch text$name.txt; done

Then I delete that folder using Shift+delete for permanent delete. Same folder will be created again, but this time being deleted using the second way.

rm -rf delete/

Result and conclusion

For the first way on a file explorer, it took about 22 seconds.

The second way was much faster. Without using something like

time rm -rf delete/

you would think it's a blink of an eye. They say this happens because the explorer spends time tracking progress, updating the UI, etc. So maybe that's it.
This also applies for copying, cutting too; network transfer on Samba/SMB and FTP. In fact, on my home network, if I want to transfer multiple files fast, I usually use Filezilla instead, because despite the inconvenience, it's faster than using a file explorer, and it's multi-connection so multi transfers.