0

I need to install a piece of software with a lot of files. Our experience showed, that on highly fragmented hard drives that leads to very poor performance. So I want to include automatic disk defragmentation into my installer (which I plan to write using NSIS). How can I include a defrag command and read the results as part of my installer?

stwissel
  • 20,110
  • 6
  • 54
  • 101
  • if possible, I would recommend determining whether or not the drive is an SSD, because you shouldn't ever defrag those types of storage. I looked here and it seems like it's possible to do this, but not necessarily as easy as one call into an API. http://stackoverflow.com/questions/908188/is-there-any-way-of-detecting-if-a-drive-is-a-ssd – Dave Jan 22 '10 at 15:33

1 Answers1

2

I would integrate Jkdefrag (http://kessels.biz/JkDefrag/) in the setup and run it with the command line options to defragment only the directory where you copied the files into.

There are plenty of options and it is open source.

NOTE: It uses the defragmentation API of MS, so it is as safe to use as any other defrag tool. And you have the source if you need to adapt something or change the way the files are sorted.

jdehaan
  • 19,700
  • 6
  • 57
  • 97