Presentation Screenshots Download Support Development Forum    
            Automatic Save Folder         The filters         The options         The regular expressions

The filters

How does it work ?

The filters allow you to choose the folders you attempt to save your files to.

You can create filters using either the filename, the domain, or both.
When you download a file, ASF will then search and compare your filters with your downloaded file.
If it found a match, ASF will set the Firefox's saving path to the specified Filter's Local Folder.

The filters are checked from top to bottom until it finds a match. If there's no filter found, then it will use the default option defined at the bottom of the main preference window.
filtersnext
fig.1 Main preference window
filter window
fig.2 Filter edition window

Filter's rules

  • The filters are case insensitive (no difference between upper and lower case)
  • The filters are verified from top to bottom. The verification process stop on the first match.
  • On each filter, if the domain is not a match with the file's hosted domain, it will check it again with the current website URL.
  • You can use the wildcards character * (asterisk) to replace zero or more characters
  • You don't need the * at the beginning and the end of the filter, it's automatically added (.zip = *.zip)
  • If dynamic mode is enabled, you can use the parentheses to capture groups of letters, to create dynamic folder's name.
    ex. on filename's filter : (fire)(fox)*.exe will work like Firefox*.exe, but $1f = fire, and $2f = fox
    D:\download\$1f\$2f will create a folder by the name D:\download\fire\fox
  • You can temporarily disable a filter without deleting it by showing the hidden column "active" , and clicking on the green dot.
    Active column

Creating a simple filter

To create a filter, you need to know which file you are looking for, and where that file is located on the Internet.
You will have to decide if you want a filter for a specific website, or for a specific file type or file name.
For example, it could be archives (zip, rar, etc.), text file (subtitle, document, etc.), executable (.exe), or any other file type.

The easiest way to find it is actually to download the file, and look at the Firefox given informations. (See fig.3)

filters
fig.3 Firefox download window
When you download a file, Firefox will ask you what you wish to do with this file.
Then you can select to open it or save it to your computer.

At this step, you can see the filename and the hosted domain : This is what will interests you.
On the picture, you can see an example with notepad++ binary download.
Filename: npp5.3.1.bin.zip
Domain: http://puzzle.dl.sourceforge.net

With this information, you can now decide to save all the notepad++ revision to a specific folder, let say D:\download\npp\
The filter will need to work on every single files beginning with "npp" and ending with ".zip", and only from a "sourceforge.net" mirrors to avoid triggering this filter for another .zip file containing "npp" in the name.

Go back to the Automatic Save Folder's main preference tab by either :
- Closing the download window and choosing the menu "Tools/Automatic Save Folder...", or
- Clicking on the "+" symbol at the bottom of the saving dialog window.

filtersnext
Click on the "+" button to add a new filter
download
Fill in the data for the filter
and select the local saving folder
Filters Domain
All    
= Regexp.
File name
All    
= Regexp.
Local folder

What is done when downloading a file ?
1. When downloading a file, Automatic Save Folder will search if "sourceforge.net" string is found in the file hosted domain
2. If it's not found, it will check if "sourceforge.net" is part of the current website URL.
At this step, if no match is found, it will stop testing this filter and start with the next one at step 1.
But if the domain matches, it will continue at step 3.
3. Automatic Save Folder will now check if "npp*.zip" is part of the downloaded filename.
If it's not, this filter is not triggered, next filter will be test at step 1.
Else, if the file is a match, Automatic Save Folder Will set the "Local folder" to the Firefox saving folder and to the file explorer folder.

If not filter is found at all, Automatic Save Folder will set the "Default folder" to the Firefox saving folder and to the file explorer folder.


Filters examples : Simple mode

Here are some simple examples to understand how it's working.


  • Example 1 :
    Saves all executable files to D:\download\programs\
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder

  • Example 2 :
    Saves all files from http://mozilla.org and its sub-domains, to D:\mozilla\
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder

  • Example 3 :
    Save all archived file (file type .zip) from http://mozilla.org in D:\mozilla\zip\ and leaves other files from http://mozilla.org (not .zip) in the previous folder (D:\mozilla)
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    And place this filter above the previous one, in the filter's listing tab.
    ! Remember the filters are verified from top to bottom.

  • Example 4 :
    You can use wildcard character * (asterisk) to replace part of the domain or filename.
    Saves all Pre-release firefox version in D:\mozilla\firefox\pre\.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder

  • Example 5 :
    You can use Regular Expression to define multiple choices in one line, using the parenthesis and the pipe symbol | to separate the choices.
    (choice 1|choice 2|choice n) + regular expression enabled.
    Saves all .sql files from "localhost" or from mangaheart.org in D:\website\save sql\.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    .* = replace zero or any characters (equivalent to simple * in non Regexp filters)

  • Example 6 :
    You can use Regular Expression to build complex filters in one process.
    Saves all existing archived file type to D:\download\archives\.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    .* = replace zero or any characters (equivalent to simple * in non Regexp filters)
    \. = replace the dot . character
    $ = marks end of string, or end of line.
    \d = a decimal (0 to 9)
    {number} = repeat "number" time. So \d{2} means any number from 00 to 99


Filters examples : Advanced mode

Below this point are the filters using Advanced mode and dynamic folder creation.
(Available starting from Automatic Save Folder version 0.9.3)

To enable this mode you need to go to the Option tab and check "Advanced mode".
! Attention, this mode disable the characters verification process, by allowing you to edit the path manually.
Be aware it can prevent ASF from working correctly if you don't know what you are doing.


  • Example 1 :
    Create a dated folder, for any filter of your choice, and save it in D:\download\[dated folder]\.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    This will create D:\download\2017 10 20\

  • Example 2 :
    Create a different folder, detecting which file you are downloading.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    This will create D:\video\name of the TV-show\
    $1f takes the value of the detected choice (as it is in a global parenthesis, it returns only one choice)
    $2f would return the detected file extension.

  • Example 3 :
    Create a sub-folder for .nzb but not from other extension, for a given TV-show.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    This will create D:\video\True Blood\ for any files (zip, srt, etc.), and
    D:\video\True Blood\nzb\ for files containing "nzb" in the filename.

  • Example 4 :
    You can mix the 2 above filters in one. All TV show dynamic + creating nzb sub-folder when detected.
    Filters Domain
    All    
    = Regexp.
    File name
    All    
    = Regexp.
    Local folder
    This will create D:\video\[TV-show]\ for any files, and
    D:\video\[TV-show]\nzb\ for files containing "nzb" in the filename.

Using a combination of Advanced mode and Regular Expression, you can almost filter and create anything in only one filter.
It's up to you to play with the result. If you find a good filter, you can let other users enjoy it with a post on the mini-forum.