0

The "Trash" of a 16-GB usb2 flash drive had 3.4-GB of data. I emptied it as such:

$ cd /Volumes/FooDrive/.Trashes/501
$ rm -rf *

This took over 5-seconds. That seemed pretty long. So, as a test I just decided to empty the Trash of all of my drives via Finder. Other drives:
2-TB usb3
500-GB usb2
16-GB usb2
250-GB ssd

I measured the size of the Trash as such:

$ du -ch /Volumes/WhateverDrive/.Trashes

There was 15-GB in the Trash of the 500-GB drive, and 5-GB in the Trash of my other 16-GB flash drive. I didn't measure the other drives.

Finder appeared to take much less than 5-seconds to empty the Trash for all those drives.

  • Does Finder really empty the Trash so much more quickly than /bin/rm? How?
  • Does Finder just make the "clicking sound" (signaling the trash is empty) before the Trash on all the drives is really empty?
5

The time it takes to delete a file doesn't depend (much) on the size of the file. Thus, the number of files being deleted matters much more than the size of the files. My guess is that the trash on FooDrive had lots of small files, and that's what took so long.

I just ran a quick test on my HD, with 500,000 zero-length files scattered through 1,110 directories (10 top-level directories, each containing 10 subdirectories, each containing 10 subdirectories, each containing 50 empty files). du -ch gave their total size as 0B, but find /path/to/trash -mindepth 1 | wc -l counted 501110 items. Deleting them with rm -R took 75 seconds, while the Finder took 91 seconds. The difference was mostly that the Finder took 18 seconds "preparing" (i.e. counting the files) before actually deleting them.

Verdict: rm -R is slightly faster, but not enough to matter. Oh, and the Finder waited until all items were actually gone before playing its crinkle sound.

BTW, for some types of files (e.g. applications), the Finder will show them as single files, but they're actually a hidden folder structure that can contain a large number of files. Use find /path/to/folder -mindepth 1 | wc -l to get an accurate count of items.

  • In retrospect, I should have done more testing before posting. Thank you for your time. – david Jul 12 '15 at 9:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .