watchDirectory Help

Help Home
Creating New Tasks
Running Tasks
Task History

Plugins

Standard versus Pro
Version History

Search

See Also...




Free 30 day evaluation!
Standard version: $79 USD
Professional version: $149 USD
Buy Now!

 

German Helpfile

German Helpfile

French Helpfile

French Helpfile

Spanish Helpfile

Spanish Helpfile


Privacy Policy

Automatically Sort Files

This plugin automatically copies new and changed files to other locations based on "Sort Rules": a combination of one or more file-masks (for example *.doc) and a destination. The destination filename uses special dynamic naming syntax, giving you great flexibility.

  1. Create the sort rules.
  2. Click Test to verify that they work as expected.
  3. Click Next.
Automatically Sort Files

Settings

For each relevant file, the plugin works down the list of rules, and stops when one matches.

For example, in the above screenshot “HelloWorld.doc” matches the first and last rule. However, the plugin applies just the first rule and stops.

Example Sort Rules
The window (above) shows three sort rules:

  1. First rule: Copies new text (*\*.txt) and Word™ (*\*.doc) documents to D:\Documents\<current year>\<current month>\<day>\<original file name>.
    For example, when the new file HelloWorld.doc is detected, and the current date is February 28, 2006, the file is copied to D:\Documents\2006\February\28\HelloWorld.doc. These "target directories" are automatically created.
  2. Second Rule: Copies pictures (*\*.jpg and *\*.bmp) to “D:\Pictures\<current year>\<current month>\<day>\<original file name>”.
  3. Third Rule: Copies all other files (*) to “D:\Otherfiles\<current year>\<current month>\<day>\<original file name>”.

To configure the settings, you need to create one or more Sort Rules then test them to confirm that they work as expected.

Creating a new Sort Rule

  1. In the Automatically Sort Files configuration window, click New to open the Rule Editor.
  2. Enter the settings and click OK.
Create a new Sort Rule

Settings

Numbers in red refer to annotations on the above illustration.

Mask(s) (1)
If the file matches a mask contained by this field, the plugin copies it.
Enter one or more masks separated by semi-colons (“;”), using wildcards to stand for portions of the filename:

*The asterix stands for zero or more characters.
?The question mark stands for just one character.

Masks are case insensitive, that is, they treat upper and lower case letters as identical.

Examples

Destination file (2)
The target file. Use the {add tag} button to insert Dynamic Name tags evaluated when the task triggers. For example, {monthname} is dynamically replaced by “January”, “February”, etc. The plugin creates new directories as required.

An example of the results appears directly below the edit box.

Final Rule
If the file matches this rule, do not evaluate any further rules.
If not selected, the file is copied, and the next rules are also evaluated, meaning that the file may be copied to multiple destinations.

Delete the original file after copy
If the file matches this rule, the detected file is removed after the copy.
You can only select this option for "final rules" because rules that follow this will fail (the detected file is gone).

Masks have reversed meaning
Reverse the meaning of your masks.
So, if your masks are "*.txt;*.doc", “HelloWorld.doc” will not match, but “Grandmother.jpg” will.

Rule is disabled
Temporarily disable this rule.

Testing the Sort Rules

When you create multiple Sort Rules, it is a good idea to test them before saving your settings.

  1. In the Automatically Sort Files configuration window, click Test to open the Test Rules window.
  2. Enter a filename to test and click Test.
The message box displays the results of your test:
Testing the Sort Rules
  1. Verify your results and click Cancel to close the window.

Using the test file "C:\DummyDirectory\dummyfile.xxx", and the 3 rules explained above, you will get the following results:

matching file C:\DummyDirectory\dummyfile.xxx
   Checking mask *\*.txt: Mask did not match
   Checking mask *\*.doc: Mask did not match
This rule will NOT copy the file

matching file C:\DummyDirectory\dummyfile.xxx
   Checking mask *\*.jpg: Mask did not match
   Checking mask *\*.bmp: Mask did not match
This rule will NOT copy the file

matching file C:\DummyDirectory\dummyfile.xxx
   Checking mask *: This mask matched the file
This rule will copy the file
This is a final rule so any rules following this one will not be processed.

Using the test file "C:\DummyDirectory\dummyfile.jpg", you will get the following results:

matching file C:\DummyDirectory\dummyfile.jpg
   Checking mask *\*.txt: Mask did not match
   Checking mask *\*.doc: Mask did not match
This rule will NOT copy the file

matching file C:\DummyDirectory\dummyfile.jpg
   Checking mask *\*.jpg: This mask matched the file
This rule will copy the file
This is a final rule so any rules following this one will not be processed.

Using the test file "C:\DummyDirectory\dummyfile.jpg", but changing the first rule to have reversed meaning gives you the following results:

matching file C:\DummyDirectory\dummyfile.jpg
   Checking mask *\*.txt: Mask did not match
   Checking mask *\*.doc: Mask did not match
As this is a reversed rule, this rule will copy the file
This is a final rule so any rules following this one will not be processed.

Now press next to Configure the Directory to MonitorNext