Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logic in Disk Defragmantation & Disk Check

What is the logic behind disk defragmentation and Disk Check in Windows? Can I do it using C# coding?

like image 390
Sauron Avatar asked Jul 06 '09 07:07

Sauron


2 Answers

For completeness sake, here's a C# API wrapper for defragmentation:

http://blogs.msdn.com/jeffrey_wall/archive/2004/09/13/229137.aspx

Defragmentation with these APIs is (supposed to be) very safe nowadays. You shouldn't be able to corrupt the file system even if you wanted to.

Commercial defragmentation programs use the same APIs.

like image 104
andreialecu Avatar answered Nov 14 '22 22:11

andreialecu


Look at Defragmenting Files at msdn for possible API helpers.

You should carefully think about using C# for this task, as it may introduce some undesired overhead for marshaling into native Win32.

like image 36
inazaruk Avatar answered Nov 14 '22 22:11

inazaruk