We don't bite newbies here... much | |
PerlMonks |
Solved! Re: Re: measure Win32 disk fragmentation with Perl?by McMahon (Chaplain) |
on Apr 29, 2004 at 14:24 UTC ( [id://349140]=note: print w/replies, xml ) | Need Help?? |
Thanks paulbort! SysInternals has a tool called "contig" that was close enough that with a little Perl, I could make it Do The Right Thing. contig reports the number of fragments that comprise each file in a directory. It's normal output was surprisingly unreliable-- it skipped files apparently randomly sometimes-- but the verbose output seems to be more consistent. Also, it doesn't run continuously. In order to get a picture of fragmentation over time, the user has to run contig manually over and over. So I wrote a little controller script in Perl that runs contig every 5 seconds in verbose/recursive/analyze mode, parses the output, and writes the interesting parts to an output file. Here's the script:
I was pleasantly surprised to find that @out actually contained what I wanted it to. Made parsing the output really easy.
In Section
Seekers of Perl Wisdom
|
|