Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 24, 2013, 03:18:02 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: My scripts  (Read 1210 times)
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« on: November 19, 2010, 08:41:00 pm »

Here are the scripts (and pieces of them) I am using to optimize my disk. I only have one disk (C:) so they are all set up to only work with that because I am not interested in optimizing any other disks such as flash or memory cards I may have connected to my PC - but that's fairly easy to change if you decide to give them a try.

The files consist of two optimization scripts and seven layout "macro definitions" which allow me to share the same layout among any number of scripts I may create without need to copy them from script to script. After implementing layout files I realized it also makes the scripts easier to manage as fileactions are closer to each other.

I always use the Preprocess.MyD script always first, then the FastOptimize.MyD. This is what I use once a week and I am happy with the result. I plan to create a "MediumOptimize" script sometime to perform some sorting and filling of the last zone but I did not feel need to make one yet, that's why I'm not posting it.

There are some slight differences between standard scripts (particularly the optimizeDaily) and my ones - the layout is slightly changed (big files moved to spacehogs from any zone including boot and prefetch) and gaps are adjusted to not use rounding (which allows zero gap without visible reason) and instead use some maximum size (512 MB) if the disk is large and empty enough. Also, AddGap(DoNotVacate) is used combined with MoveUpToZone() which I consider better than vacating to just above active area and rolling files around the disk till they fall to their places.

The preprocess script is just supposed to move files up to their zones so they don't lie in the way for later "normal run" because at present version MyDefrag does not handle certain situations with such files well. It may work badly if there is large amount of unmovable files on the disk about which MyDefrag does not know yet, but in normal cases it just prevents problems I mentioned.

The FastOptimize is a lighter variant of OptimizeDaily - there's no sorting in it and it also does not perform filling of spacehogs zone. It may look strange at first but on an empty enough disk (which is my case) there is no real problem with it and I prefer slightly diluted spacehogs zone over multi-gigabyte file transfers every time I run the optimization. On a disk which is more full it is easy to add FastFill there, too. Unfortunately there is no conditional processing in MyDefrag which would allow me to perform FastFill only under right conditions (e.g. free space too fragmented) so I decided to use what suits me best although it is not perfectly generic.

layout1_ntfs.txt:
Code:
  MakeGap(VolumeUsed * 0.3, DoNotVacate)

  FileSelect
    SelectNtfsSystemFiles(yes)
  FileActions

layout2_dirs.txt:
Code:
  FileEnd

  FileSelect
    Directory(yes)
  FileActions

layout3_boot.txt:
Code:
  FileEnd

  MakeGap(0)

  FileSelect
    ImportListFromBootOptimize()
    and Size(0, 50 Mi)
  FileActions

layout4_hints.txt:
Code:
    AddGap(Minimum(ZoneEnd + VolumeFree / 100, ZoneEnd + 512 Mi), DoNotVacate)
  FileEnd

  FileSelect
    ImportListFromProgramHints("*.pf")
    and Size(0, 50 Mi)
  FileActions

layout5_other.txt
Code:
    AddGap(Minimum(ZoneEnd + VolumeFree / 100, ZoneEnd + 512 Mi), DoNotVacate)
  FileEnd

  FileSelect
    not(
      Size(50000000,0)
      or (LastAccessEnabled(yes) and LastAccess(,1 month ago))
      or DirectoryName("$RECYCLE.BIN")
      or DirectoryName("RECYCLED")
      or DirectoryName("RECYCLER")
      or DirectoryName("$*")
      or DirectoryName("Downloaded Installations")
      or DirectoryName("Ehome")
      or DirectoryName("Fonts")
      or DirectoryName("Help")
      or DirectoryName("I386")
      or DirectoryName("IME")
      or DirectoryName("Installer")
      or DirectoryName("ServicePackFiles")
      or DirectoryName("SoftwareDistribution")
      or DirectoryName("Speech")
      or DirectoryName("Symbols")
      or DirectoryName("ie?updates")
      or DirectoryName("dllcache")
      or DirectoryName("Installshield Installation Information")
      or DirectoryName("System Volume Information")
      or DirectoryName("windows.old")
      or FileName("*.7z")
      or FileName("*.arj")
      or FileName("*.avi")
      or FileName("*.bak")
      or FileName("*.bup")
      or FileName("*.bz2")
      or FileName("*.cab")
      or FileName("*.chm")
      or FileName("*.dvr-ms")
      or FileName("*.gz")
      or FileName("*.ifo")
      or FileName("*.iso")
      or FileName("*.log")
      or FileName("*.lzh")
      or FileName("*.mp3")
      or FileName("*.msi")
      or FileName("*.old")
      or FileName("*.pdf")
      or FileName("*.rar")
      or FileName("*.rpm")
      or FileName("*.tar")
      or FileName("*.wav")
      or FileName("*.wmv")
      or FileName("*.vob")
      or FileName("*.z")
      or FileName("*.zip")
      )
  FileActions

layout6_hogs.txt:
Code:
    AddGap(Minimum(ZoneEnd + VolumeFree / 100, ZoneEnd + 512 Mi), DoNotVacate)
  FileEnd

  FileSelect
    all
  FileActions

layout7_end.txt:
Code:
  FileEnd

preprocess.MyD:
Code:
Title('Preprocess C')
Description('Preprocessing of C: drive')

WhenFinished(exit)

VolumeSelect
  Name("c:")
VolumeActions

  !include "layout1_ntfs.txt"!

    # no action

  !include "layout2_dirs.txt"!

    MoveUpToZone()

  !include "layout3_boot.txt"!

    # no action

  !include "layout4_hints.txt"!

    MoveUpToZone()

  !include "layout5_other.txt"!

    MoveUpToZone()

  !include "layout6_hogs.txt"!

    MoveUpToZone()

  !include "layout7_end.txt"!

VolumeEnd

FastOptimize.MyD:
Code:
Title('Fast Optimize C')
Description('Fast optimization of C: drive')

WhenFinished(exit)

VolumeSelect
  Name("c:")
VolumeActions

  !include "layout1_ntfs.txt"!

    PlaceNtfsSystemFiles(Ascending,MftSize * 0.1)

  !include "layout2_dirs.txt"!

    Defragment(Fast)
    FastFill()
    MoveUpToZone()

  !include "layout3_boot.txt"!

    Defragment(Fast)
    FastFill()

  !include "layout4_hints.txt"!

    Defragment(Fast)
    FastFill()
    MoveUpToZone()

  !include "layout5_other.txt"!

    Defragment(Fast)
    FastFill()
    MoveUpToZone()

  !include "layout6_hogs.txt"!

    Defragment(Fast)
    MoveUpToZone()

  !include "layout7_end.txt"!

VolumeEnd

« Last Edit: November 19, 2010, 08:53:03 pm by Kasuha » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!