Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 23, 2013, 09:43:29 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: "Sort by name" but exclude files from certain directories (trees)?  (Read 1758 times)
pstein
JkDefrag Senior
****
Posts: 20


View Profile
« on: September 10, 2011, 04:10:58 pm »

MyDefrag works fine (especially "SortByName" script) but I am searching for a bit more advanced version:

I need a "sortbyname" script which sorts+defrag most/all of the files by name BUT EXCEPT some directories trees e.g. beginning with
D.\data\
D:\aaa\bbb\

Files in these  "special" directories trees should be put on the "fast" end of the hard disc whereas all other remaining "normal" files should be put on the "slow" hard disc end.

Or in general: on opposite ends.

Is this somehow possible?

How should I have to rewrite the "SortByName" script that such a directory split is possible?

Thank you
Peter
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #1 on: September 10, 2011, 05:27:44 pm »

Code:
VolumeActions

  /* Sort important files */
  FileSelect
    DirectoryPath("d:\data")
    or DirectoryPath("d:\aaa\bbb")
  FileActions
    SortByName(Ascending)
  FileEnd

  /* place "normal" files */
  FileSelect
    all
  FileActions
    Defragment(Fast)
    Defragment()
    FastFill()
  FileEnd

VolumeEnd

I wouldn't recommend placing the "normal" files at the (slow) end of the volume, that would be a waste of fast space. Note that you might increase performance if you consolidate all directories and placing the MFT next to them. Look at the Data Disk script for example.
Logged

Need help creating a script? Try MyDefrag Script Creator.
pstein
JkDefrag Senior
****
Posts: 20


View Profile
« Reply #2 on: September 26, 2011, 10:23:10 am »

Code:
VolumeActions

  /* Sort important files */
  FileSelect
    DirectoryPath("d:\data")
    or DirectoryPath("d:\aaa\bbb")
  FileActions
    SortByName(Ascending)
  FileEnd

  /* place "normal" files */
  FileSelect
    all
  FileActions
    Defragment(Fast)
    Defragment()
    FastFill()
  FileEnd

VolumeEnd

I wouldn't recommend placing the "normal" files at the (slow) end of the volume, that would be a waste of fast space. Note that you might increase performance if you consolidate all directories and placing the MFT next to them. Look at the Data Disk script for example.

Ok, thank you. Just a few questions about the code above:

You said that "normal" file would be placea at the slow end of the volume. I guess you mean with "normal" files all files which do not match the patterns in the first block. Correct?
Which statement in your script tells the Defragmenter to put all remaining files at the slow end?
From my point of view

Defragment(Fast) and Defragment() tells the Defragmenter to defragment the files but NOT where to put them.
Hmm FastFill() seems to have to do something with the move method.
But I expect a statement like:

   Position(endofharddisc)

or something similar. So where are the statements for the final, target file positions?

Peter
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #3 on: September 26, 2011, 12:28:36 pm »

I guess you mean with "normal" files all files which do not match the patterns in the first block. Correct?
Yes.

Which statement in your script tells the Defragmenter to put all remaining files at the slow end?
Actually, there is none, like I said in the comment below the script. Moving them to the very end is not a good idea in my opinion, but if you want to move them to the end of the volume replace all three lines in the last FileActions block with "MoveToEndOfDisk()".
Logged

Need help creating a script? Try MyDefrag Script Creator.
pstein
JkDefrag Senior
****
Posts: 20


View Profile
« Reply #4 on: October 03, 2011, 02:25:07 pm »

I guess you mean with "normal" files all files which do not match the patterns in the first block. Correct?
Yes.

Which statement in your script tells the Defragmenter to put all remaining files at the slow end?
Actually, there is none, like I said in the comment below the script. Moving them to the very end is not a good idea in my opinion, but if you want to move them to the end of the volume replace all three lines in the last FileActions block with "MoveToEndOfDisk()".

Thank you for the reply.
But maybe I am stupid but I still miss the/your core statement about how MyDefrag knows where to put the files onto the disc. If you read my initial posting then you can see that I want to split all files into two groups AND put them onto opposite ends of the hard disc.

One group fo "special" files (filtered by your first FileSelect filter) and a second group of all remaining files (matched by your second FileSelect statement).

Fine so far. Now we have a splitting.

But how does MyDefrag Script analyser/parser engine knows that all the files matched by the first FileSelect statement should be move to the beginning of the hard disc and all remaining to the other end? Yes, I know its not recommendable but I would like to know it.

You mentioned the command "MoveToEndOfDisk()". But I cannot see this statement in your script code.

So are all the files put on the fast end? But this is not what I initially wanted/asked.
Furthermore in this case the two FileSelect statements wouldn't make sense.
What advantage should a split with two FileSelects have if all files are merged at the end into fast end again?

Thank you
Peter
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #5 on: October 03, 2011, 04:51:10 pm »

But maybe I am stupid but I still miss the/your core statement about how MyDefrag knows where to put the files onto the disc.
If not specified otherwise, MyDefrag will aways try to move the files to the beginning of the volume.

You mentioned the command "MoveToEndOfDisk()". But I cannot see this statement in your script code.
I've mentioned it and told you how to integrate it instead of posting the script again. These are the volume actions you want:
Code:
VolumeActions

  /* Sort important files */
  FileSelect
    DirectoryPath("d:\data")
    or DirectoryPath("d:\aaa\bbb")
  FileActions
    SortByName(Ascending)
  FileEnd

  /* place "normal" files at the end of the volume*/
  FileSelect
    all
  FileActions
    MoveToEndOfDisk()
  FileEnd

VolumeEnd

What advantage should a split with two FileSelects have if all files are merged at the end into fast end again?
For example sorting the important files and placing them at the fastest place on the volume. Or you could ask the other way around: What advantage is there to place the two file groups at the opposite ends on the volume (except that it looks nice on the diskmap)?
Logged

Need help creating a script? Try MyDefrag Script Creator.
pstein
JkDefrag Senior
****
Posts: 20


View Profile
« Reply #6 on: October 25, 2011, 08:21:34 am »

Ok, I put now everything together into my own script (see bottom of this posting).
And run it by the following command:

"D:\tools\MyDefrag\MyDefrag.exe" Scripts\mySortByName.MyD D:

The two directory (trees) d:\video\ (approx 120GB) and d:\server\logs\ (50GB) contain (big) files which I rarely need.

As you can see from the attached map snapshot AFTER the run. The files from these two special directory trees are NOT moved to the end of the disk. Why not?


# MyDefrag v4.0 modified script: mySort By Name

Title('Sort By Name - Move media files to end')
Description('
Sort all the files and directories by name on all the selected disk(s).
')

VolumeSelect
  CommandlineVolumes()
VolumeActions

  FileSelect
    DirectoryPath("d:\videos")
    or DirectoryPath("d:\server\logs")
  FileActions
    SortByName(Ascending)
    MoveToEndOfDisk()
  FileEnd

  FileSelect
    all
  FileActions
    SortByName(Ascending)
  FileEnd

VolumeEnd



* Capture-20111025-073856.png (41.28 KB, 1242x689 - viewed 252 times.)
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #7 on: October 25, 2011, 11:15:54 am »

  FileSelect
    DirectoryPath("d:\videos")
    or DirectoryPath("d:\server\logs")
  FileActions
    SortByName(Ascending)
    MoveToEndOfDisk()
  FileEnd
Not only is the "SortByName(Ascending)" completely unnecessary, it may also be the cause of the problem. Remove it and then run the script again.
Logged

Need help creating a script? Try MyDefrag Script Creator.
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!