all groups > dotnet interop > november 2007 >
You're in the

dotnet interop

group:

defrag API



defrag API Trapulo
11/28/2007 3:15:30 PM
dotnet interop: Hello,
is there any way or documentation to access windows defrag API for ntfs from
NET ?

thanks



RE: defrag API wawang@online.microsoft.com (
11/29/2007 3:12:51 AM
Hi Trapulo,

There's no official documentation on how to use defrag api from .NET, but
there's some example code:

#Jeffrey Wall's WebLog : Defrag API C# wrappers
http://blogs.msdn.com/jeffrey_wall/archive/2004/09/13/229137.aspx


Hope this helps.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Re: defrag API Trapulo
12/1/2007 4:03:36 PM
Thank you, this is a starting point.

Is there the official documentation about defrag api? I cannot find it.

thanks


[quoted text, click to view]

Re: defrag API Willy Denoyette [MVP]
12/1/2007 6:42:45 PM
I guess Walter meant that the low level Defrag API's are not publically
available. What are you trying to achieve here?
User applications can use WMI (System.Management) to defragment
drives/volumes.

Willy.


[quoted text, click to view]

Re: defrag API wawang@online.microsoft.com (
12/3/2007 6:32:19 AM
Thanks Willy for your input.

Hi Trapulo,

Would you please let us know what's your requirement here?

You may find following information helpful to understand how defragment
works:

#Inside Windows NT Disk Defragmenting
http://www.microsoft.com/technet/sysinternals/information/DiskDefragmenting.
mspx

To add to Willy's suggestion about defragment using WMI, please refer to
following document:

#Defragmenting Disks the Windows 2003 Way
http://www.microsoft.com/technet/scriptcenter/topics/win2003/defrag.mspx


Hope this helps.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Re: defrag API Trapulo
12/5/2007 1:20:31 PM
I'd like to create some service to automatically defrag some files/folders
with my own logic. Not an entire volume, but files I want using the rules I
want to relocate them. Using win APIs to be sure to leave the file system
ok.
The first example you posted in previous message is a good starting point to
this goal, but without a serious documentation about APIs it seems it's too
hard creare this software.

The first page you posted here is an other good help, but the WMI document
isn't useful because I don't need to start the standard windows engine, but
manually to relocate my files where I want.

thanks

[quoted text, click to view]

Re: defrag API wawang@online.microsoft.com (
12/10/2007 4:54:31 AM
Hi Trapulo,

We currently don't have much public documentation on the low level
defragment APIs, I suggest you to contact our Advisory Service for more
support on this.

By the way, if your objective here is to make a single file continuous, you
might find contig.exe useful:

#Contig v1.54
http://www.microsoft.com/technet/sysinternals/FileAndDisk/Contig.mspx
<quote>
Contig is a single-file defragmenter that attempts to make files contiguous
on disk. Its perfect for quickly optimizing files that are continuously
becoming fragmented, or that you want to ensure are in as few fragments as
possible.
</quote>


Hope this helps.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Re: defrag API Trapulo
12/14/2007 10:45:34 PM
[quoted text, click to view]

this is not good, however thanks for your assistance anyway

[quoted text, click to view]

this is not useful for my goal, but it's interesting anyway :)



AddThis Social Bookmark Button