Yes, in the 1980s hard drive "optimizers" were vital pieces of software that many of us ran at least a few times a year.
Nowadays, every couple of years I get a new hard drive, and copy the old one over. I presume (and hope that I am correct) that it copies one file at a time in one chunk and gives me a fresh unfragmented new start.