mydefrag_jp @ ウィキ
このWikiはMyDefragのマニュアルの翻訳サイトです。


Scripts



Link



更新履歴

取得中です。

FileAction


※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

原文: http://www.mydefrag.com/Scripts-FileActions.html
更新日: 2010/12/12 (ここで取り扱っている内容の原文をコピーした日付です)

AddGap

Set the position of the beginning of the next zone. This command is commonly used to create a gap at the end of the zone, making the zone bigger than necessary for the files in the zone, but the command can also be used to position a zone anywhere on disk.

  • The command will be skipped (not executed) if the zone is empty (no files are selected by the FileBoolean).
  • The NUMBER specifies the beginning of the next zone, an absolute position on the disk. Usually it will be the ZoneEnd plus a number of bytes, but you can specify a different formula.
  • The command will do nothing if the NUMBER is negative. It is an absolute position on disk, and a negative number would be before the beginning of the disk.
  • The program will automatically vacate the gap between the current end of the zone and the NUMBER. It will not vacate if the DoNotVacate option is specified, or if the NUMBER is lower than current end of the zone (negative gap).
  • If all the next zones are sorted zones (using one of the SortBy fileactions) then DoNotVacate can be used, it will save some unnecessary data movements.
  • The * FastFill and * MoveDownFill fileactions will only move files down, never up, so files that are in a DoNotVacate gap will be left in the gap.

Syntax
 AddGap(NUMBER [, DoNotVacate])

Example
 # Add a gap of 1% of the free size of the volume.
 AddGap(ZoneEnd + VolumeFree * 0.01)

 # Same, but do not vacate.
 AddGap(ZoneEnd + VolumeFree * 0.01 , DoNotVacate)

 # Add a gap 1% of the volume size:
 AddGap(ZoneEnd + VolumeSize * 0.01)

 # Add a gap of 1000 clusters.
 AddGap(ZoneEnd + 1000 * BytesPerCluster)

 # Add a gap 10% of the size of the MFT.
 AddGap(ZoneEnd + MftSize * 0.1)

See also:
  • MakeGap
  • FileActions


Defragment

Defragment all the selected items. Items that are not fragmented are ignored, they are not moved.

  • Fragmented files are moved to somewhere above the beginning of the zone, possibly outside the zone.
  • Defragment() will not optimize the zone, it does not move all files to the zone. To do that you need to use another fileaction, for example FastFill(). But not a SortBy fileaction, because those will already defragment all items and Defragment() would then do double work.
  • There are 2 defragmentation algorithms to choose from. The * Fast algorithm will only defragment a file if it can find a gap big enough for the entire file. It will skip files that are too big for any gap. The default defragmentation algorithm will not give up so easily, if it encounters a big file and cannot find a big gap then it will try to make a big gap by shuffling other files around. This can take a lot of time.
  • If the * IgnoreWrapAroundFragmentation setting is active (the default) then wrap-around fragmentation is not defragmented.

Syntax
 Defragment(OPTIONS)

Options:
  • Fast
  • ChunkSize

Example
 FileSelect
   ....
 FileActions
   Defragment()
 FileEnd

See also:
  • IgnoreWrapAroundFragmentation
  • FileSelect
  • FileBoolean
  • FileActions




FastFill

Fill gaps as best as possible with items from above the gap, in other words, consolidate free space. FastFill is a very fast and effective way to reduce the number of gaps on the disk, and at the same time move files as far to the beginning of the disk as possible.

  • FastFill tries to perfectly fill gaps by looking for combinations of files. If no combination can be found and without the * WithShuffling option then the largest file that fits in the gap will be used, leaving a smaller gap. If all files above the gap are larger than the gap then the gap cannot be filled and will be skipped. If the WithShuffling option is specified then the file just above the gap will be moved away, making the gap bigger. The program will then try again to find a perfect fit.
  • When looking for a combination of perfectly fitting files the program does not test all combinations of all files. It has to limit itself because the number of permutations for even a small set of files is astronomical.
  • There is a tendency for small files to migrate to the beginning of the zone and large files to the end. This is because small files have a better chance to fit into a gap and are therefore more likely to move down.
  • FastFill will destroy the ordering of the files. If the zone was optimized earlier (in another MyDefrag session, running another script) by one of the SortBy actions, then consider using * MoveDownFill instead. It is slower but it will preserve the ordering.

Syntax
 FastFill()

Options:
  • WithShuffling

Example
 FileSelect
   ....
 FileActions
   # Fill gaps with items from above.
   FastFill()
 FileEnd

See also:
  • WithShuffling
  • MoveDownFill
  • ForcedFill
  • FileSelect
  • FileBoolean
  • FileActions


ForcedFill

Move all data as fast as possible to the beginning of the zone. The function will take the highest data on disk and split it into fragments that perfectly fill the gaps at the beginning of the zone, until the first gap is after the last data.

Syntax
ForcedFill()

Example
FileSelect
 ....
FileActions
 # Fill gaps with items from above.
 ForcedFill()
FileEnd

See also:
  • MoveDownFill
  • FastFill
  • FileSelect
  • FileBoolean
  • FileActions



MoveDownFill

Fill all the gaps by moving (shifting) items to the beginning of the zone. This will perfectly fill all the gaps and will preserve the sorting order of the files.

  • A tiny little gap somewhere at the beginning of the zone will cause all items above the gap to be moved (shifted). In this case MoveDownFill() is only a little faster than a full SortBy***(). However, if the gap happens to be further into the zone then MoveDownFill() will save time.

Syntax
 MoveDownFill()

Example
 FileSelect
   ....
 FileActions
   # Fill gaps with items from above.
   MoveDownFill()
 FileEnd

See also:
  • FastFill
  • ForcedFill
  • FileSelect
  • FileBoolean
  • FileActions



MoveToEndOfDisk

Move the selected files to the end of the disk. More specifically: for every selected file try to find a gap above that file big enough to hold the file, and move the file to the end of that gap. If no gap is found then skip the file.

  • Files are automatically defragmented when they are moved.
  • This action is relatively slow, best to be used for big files only. It's because the Microsoft defragmentation API is not very efficient in finding the last gap suitable for a file.
  • The end of the disk is the slowest part of the disk. Many people want to move the spacehogs zone (with less important files that take up a lot of space) to the end of the disk, leaving a huge empty gap between the regular files and the spacehogs. In my opinion this is a waste of perfectly good harddisk space and makes the spacehogs slower than they need to be. This is why the standard MyDefrag scripts do not move the spacehogs to the end of the disk.

Syntax
 MoveToEndOfDisk()

Example
 FileSelect
   ....
 FileActions
   # Move files to the end of the disk.
   MoveToEndOfDisk()
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions



MoveUpToZone

Move the selected files to above the beginning of the zone. Files that are already above the beginning of the zone are not moved. If there is no gap above the beginning of the zone that is big enough for a particular file, then the file is not moved.

  • Files are automatically defragmented when they are moved.
  • This action is designed to be used in cases where the beginning of the zone has been moved upwards by a * MakeGap volumeaction and the other fileactions would not move all the files. An example is the * FastFill fileaction, which only moves files down, never up, so files could stay before the beginning of the zone. MoveUpToZone() is not needed in zones that use a SortBy fileaction, because those actions will already move all files to the zone, even files that are before the beginning of the zone.

Syntax
 MoveUpToZone()

Example
 # Place the next zone at 50% of the volume.
 MakeGap(VolumeSize * 0.5, DoNotVacate)
 # Select files for the zone.
 FileSelect
   ....
 FileActions
   # Make sure all files are above the beginning of the zone.
   MoveUpToZone()
   # FastFill gaps in the zone with files from above the zone.
   FastFill()
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions


PlaceNtfsSystemFiles

Place the selected items and sort alphabetically by their full pathname, ascending from A to Z or descending from Z to A. This function is intended to be used together with the * SelectNtfsSystemFiles fileboolean. It is basically the same as the * SortByName fileaction, except that files can be placed inside the NTFS reserved area.

  • MyDefrag does not (cannot) change the size or location of the NTFS reserved area. The NUMBER parameter is only used to create a gap after the MFT. When Windows is booted it will automatically re-allocate the NTFS area. First it tries to place the area just after the MFT, using whatever free gap is there up to a maximum of 12.5% of the size of the volume. If there is no gap after the MFT then Windows places the area elsewhere on disk. Windows will also reset the area when the disk is mounted, see the MyDefrag * DismountVolume action. So, to move the NTFS reserved area you have to immediately boot the computer after using MyDefrag, and even then it is not guaranteed that the NTFS reserved area will have the size and place that you want.
  • If the MFT is not selected then the NUMBER is ignored.
  • It is useless to combine this fileaction with other fileactions, such as "Defragment()" or "FastFill()", because it moves all the files in the zone. Another fileaction would either needlessly move files, or would destroy the sorted order of the files.

Syntax
 PlaceNtfsSystemFiles(OPTIONS , NUMBER)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

The NUMBER parameter is a hint, specifying a desired size for the NTFS reserved area.

Example
 FileSelect
   # Select all the NTFS system files.
   SelectNtfsSystemFiles(yes)
 FileActions
   # Place the NTFS system files, NTFS reserved area is 10% of the MFT.
   PlaceNtfsSystemFiles(Ascending,MftSize * 0.1)
 FileEnd

See also:
  • SelectNtfsSystemFiles
  • DismountVolume
  • ReclaimNtfsReservedAreas

  • AppendLogfile
  • BatteryPower
  • Debug
  • Description
  • DiskmapFlip
  • ExcludeFiles
  • ExcludeVolumes
  • ExitIfTimeout
  • FileMoveChunkSize
  • IgnoreWrapAroundFragmentation
  • Language
  • MaxRunTime
  • Message
  • OtherInstances
  • Pause
  • ProcessPriority
  • RememberUnmovables
  • RunProgram
  • RunScript
  • SetColor
  • SetFileColor
  • SetScreenPowerSaver
  • SetScreenSaver
  • SetStatisticsWindowText
  • SetVariable
  • Slowdown
  • StatusBar
  • Title
  • WhenFinished
  • WindowSize
  • WriteLogfile
  • ZoomLevel


SortByCreationDate

Place the selected items and sort by the time they were created, from oldest to newest ("ascending") or from newest to oldest ("descending").

  • The creation date can be newer than the last-changed date, for example when a file was downloaded, or unpacked from an archive (such as zip or arj).
  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortByCreationDate(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 FileSelect
   ....
 FileActions
   # Sort the items by CreationDate time, most recently accesses items first.
   SortByCreationDate(Descending)
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions


SortByImportSequence

Place the selected items and sort by the sequence in which they were imported ("ascending") or in reversed order ("descending").

  • This function is designed to be used in combination with the * ImportListFromBootOptimize or the * ImportListFromFile file boolean.
  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortByImportSequence(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 # Optimize the system disk for faster booting.
 FileSelect
   ImportListFromBootOptimize()
 FileActions
   SortByImportSequence(Ascending)
 FileEnd

See also:
  • ImportListFromBootOptimize
  • ImportListFromFile
  • FileSelect
  • FileBoolean
  • FileActions


SortByLastAccess

Place the selected items and sort by their LastAccess time from oldest to newest ("ascending") or from newest to oldest ("descending").

  • Sorting by LastAccess date/time may seem like a good idea at first, but is far from perfect. The theory is that the LastAccess times will be the same on all the files that are used by an application, so sorting by LastAccess will put all the files of the application together on disk. But the LastAccess time is also updated in many other cases, not only when you run an application. In my view sorting by LastAccess can be useful in certain situations, but is essentially random and should not be used for the bulk of the data on regular disks.
  • Sorting in "Ascending" order will put the oldest (never accessed) files at the beginning of the zone. So, the files that you use the most are placed at the end of the zone, which is a slower part of the harddisk and (usually) further away from the MFT and the directories.
  • Sorting in "Descending" order will put the last accessed files at the beginning of the zone. So, the files that are accessed first when you start a program are placed behind files that are accessed later. Your harddisk will be working backwards.
  • Vista by default does not update the LastAccess time. For more information see * What is "NtfsDisableLastAccessUpdate"?
  • On FAT volumes the resolution of the LastAccess time is 1 day. NTFS delays updates to the LastAccess time by up to one hour.
  • Some improperly programmed utilities cause a change in the LastAccess time of all items on the disk when they scan the disk. Examples are virus scanners, backup programs, text indexers.
  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortByLastAccess(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 FileSelect
   ....
 FileActions
   # Sort the items by LastAccess time, most recently accesses items first.
   SortByLastAccess(Descending)
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions



SortByLastChange

Place the selected items and sort by the time they were last changed, from oldest to newest ("ascending") or from newest to oldest ("descending").

  • The last-changed date can be older than the creation date, for example when a file was downloaded, or unpacked from an archive (such as zip or arj).
  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortByLastChange(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 FileSelect
   ....
 FileActions
   # Sort the items by LastChange time, most recently accesses items first.
   SortByLastChange(Descending)
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions


SortByName

Place the selected items and sort alphabetically by their full pathname, ascending from A to Z or descending from Z to A.

  • Items are not just sorted by their filename (for example "explorer.exe"), but by their full pathname including all the folder names (for excample "c:\windows\explorer.exe"). The result is that all items that are in the same folder are placed in a block together on disk, and inside that block they're sorted by their filename.
  • If a file has multiple names (hard links) then the file is sorted by the first name that happens to be mentioned in the FAT/MFT.
  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortByName(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 FileSelect
   ....
 FileActions
   # Sort the items by their full path.
   SortByName(Ascending)
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions



SortByNewestDate

Place the selected items and sort by creation, last access, or last change date/time, whichever is newest, from oldest to newest ("ascending") or from newest to oldest ("descending").

  • Sorting by newest date/time may seem like a good idea at first, but is far from perfect. The theory is that the newest date/times will be the same on all the files that are used by an application, so sorting by the newest time will put all the files of the application together on disk. But the date/times are also updated in many other cases, not only when you run an application. In my view sorting by newest date/time can be useful in certain situations, but is essentially random and should not be used for the bulk of the data on regular disks.
  • Sorting in "Ascending" order will put the oldest files at the beginning of the zone. So, the files that you use the most are placed at the end of the zone, which is a slower part of the harddisk and (usually) further away from the MFT and the directories.
  • Sorting in "Descending" order will put the newest files at the beginning of the zone. So, the files that are accessed first when you start a program are placed behind files that are accessed later. Your harddisk will be working backwards.
  • The creation date can be newer than the last-changed date, for example when a file was downloaded, or unpacked from an archive (such as zip or arj).
  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortByNewestDate(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 FileSelect
   ....
 FileActions
   # Sort the items by newest time.
   SortByNewestDate(Descending)
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions



SortBySize

Place the selected items and sort by size from smallest to largest ("ascending") or from largest to smallest ("descending").

  • This action will also defragment. It is therefore not necessary to combine it with the * Defragment action.
  • This action will create "wrap around" fragments. For more information see the * IgnoreWrapAroundFragmentation setting.

Syntax
 SortBySize(OPTIONS)

The OPTIONS are a space-separated list of these keywords:
  • Ascending
  • Descending
  • SkipBlock

Example
 FileSelect
   ....
 FileActions
   # Sort the items from smallest to largest.
   SortBySize(Ascending)
 FileEnd

See also:
  • FileSelect
  • FileBoolean
  • FileActions