Skip to main content

Naming and sorting

In this step you define the convention BarcodeOCR uses to name the output documents. You can also sort the documents into subfolders, replace text in the file name and decide what happens when file names are the same.

Naming step in the configuration wizard with the file name options

Selection of the file name​

Use original file name

BarcodeOCR only splits the document and does not rename it based on the barcodes. The output documents keep the original file name.

Typical use: a preprocess already renames the documents, and the file name should be kept.
Use recognized barcode as the file name

BarcodeOCR names the document after the recognized barcode.

Typical use: you want to find the documents in the file system by their barcode.

Additional naming options​

Add to the file name as a prefix

Puts the characters you enter at the beginning of the file name. You can use placeholders.

Typical use: every file name should start with the current date or a timestamp, so that the file explorer sorts the files chronologically.
Add to the file name as a suffix

Puts the characters you enter at the end of the file name. You can use placeholders.

Typical use: the original file name should also appear in the file name, so that you can relate the file to the source document.
Replace characters in the file name that are invalid in NTFS with

These characters are invalid in file names on the NTFS file system: / ? < > \ : * | ". In the text box you define the character BarcodeOCR replaces them with. If you leave the box empty, BarcodeOCR removes the invalid characters.

Without this option, BarcodeOCR cannot create a file with this name. The file then ends up in the error folder as "Naming Error".

Typical use: a barcode contains characters that are not allowed in a file name.

Section for creating subfolders and sorting the result files in the wizard

Create subfolders and sort the result files​

BarcodeOCR can create a folder structure in the output folder and sort the output files into it. BarcodeOCR creates missing subfolders automatically during processing. The result file is then saved in that folder with the intended file name.

To do this, turn on Create subfolders in the outputfolder and sort the output documents into that folders based on the following criterias and choose one of the two options.

Use a template for the sort​

Standard edition and higher

A template covers many use cases. For some templates you adjust the result to your needs with the Parameter field.

In the examples, the subfolder is the part between Outputfolder\ and the file name.

TemplateParameterSample barcodeResult
Date (Format: yy-MM-dd)no parameter neededINVOICE-1234Outputfolder\2017-07-12\INVOICE-1234.pdf
Date (Format: MM-dd)no parameter neededINVOICE-1234Outputfolder\07-12\INVOICE-1234.pdf
Date (Format: MM-dd-HH)no parameter neededINVOICE-1234Outputfolder\07-12-19\INVOICE-1234.pdf
Day (dd)no parameter neededINVOICE-1234Outputfolder\07\INVOICE-1234.pdf
Hour (HH)no parameter neededINVOICE-1234Outputfolder\19\INVOICE-1234.pdf
Subfolder based on delimiterdelimiter, for example @INVOICES@2017@004Outputfolder\INVOICES\2017\004\INVOICES@2017@004.pdf
Custom Date Formatdate format, for example yyyyMMddHHmmssINVOICE-1234Outputfolder\20170712191045\INVOICE-1234.pdf
Use the first X characters from barcode as subfoldernumber of characters, for example 7INVOICE-1234Outputfolder\INVOICE\INVOICE-1234.pdf
Use the last X characters from barcode as subfoldernumber of characters, for example 4INVOICE-1234Outputfolder\1234\INVOICE-1234.pdf

Use an external script to define the name of the subfolder​

Enterprise edition and higher

The templates may not cover complex folder structures. In these cases you can use a PowerShell script that defines the folder structure and the file name. BarcodeOCR calls the script during processing, before the document is saved. It passes all information about the processing to the script as variables.

The script can evaluate this information without restrictions and returns the folder path and the file name to BarcodeOCR. BarcodeOCR then uses them when it saves the file.

With a script you can, for example:

  • Sort documents into subfolders based on the recognized text (a sample script is included in the "Script Samples" folder).
  • Sort invoices into an "Invoices" folder, receipts into a "Receipts" folder and all other documents into a "Miscellaneous" folder, based on a specific text in the barcode (a sample script is included in the "Script Samples" folder).
  • Determine a subfolder with your own algorithm (using all the options PowerShell offers).
  • Set the file name independently of the folder.
  • Create several nested subfolders.
  • Use barcodes that were recognized but excluded by a filter as the subfolder.
  • Cover many other requirements.

The structure, parameters and return values of the script are described in Type 3: PowerShell during processing.

Sample scripts

You find samples for downstream applications and subfolder scripts in the "Script Samples" folder in the BarcodeOCR installation folder. Use them as a starting point and adapt them to your needs.

PowerShell execution policy

PowerShell scripts must be signed, or you must adjust the execution policy (ExecutionPolicy) first. Otherwise BarcodeOCR cannot run the script. It then writes an entry to the error log and does not save the output files in the path you defined. How to set the policy is described in Prepare PowerShell.

Replace text in the output file name​

You can replace strings within the barcodes with another string or with placeholders.

  1. Enter the text to find, for example INV-.
  2. Enter the text to replace it with, for example INVOICE-.
  3. Click Add to list to apply the replacement.

You can save several replacements. BarcodeOCR processes them in the order shown. To delete a replacement, click the entry and then Remove from list.

Examples​

FindReplace withBarcode textAfter replacement
INV-INVOICE-INV-12345INVOICE-12345
DATE%TODAY%SCAN-DATESCAN-01.01.16
Invoice(empty)Invoice56785678

All available placeholders are listed under Placeholders.

Conflict resolution section for the target and error folder in the wizard

Conflict resolution​

Conflicts in the target folder​

If a conflict arises when saving, for example because a barcode appeared twice in a batch, you have the following options:

Move duplicates to error folder

The document is filed in the error folder with the name "Duplicate".

Typical use: the document was processed before, and the file name already exists in the target folder.
Overwrite duplicates

The new document overwrites the existing file in the target folder without further checks.

Typical use: the document was processed before, and the file name already exists in the target folder.
Intended file name + consecutive number

The document is filed under the intended name. BarcodeOCR attaches a consecutive number so that the file name stays unique.

Typical use: documents scanned twice should neither be overwritten nor sorted out, but also saved in the output folder.
Attach to existing files

BarcodeOCR attaches the pages to a PDF document that already exists in the output location. If there is no target document yet, it is created.

Typical use: pages from different scans should be combined into one target file, which you remove from the output folder by hand once the process is complete.

Conflicts in the error folder​

If a conflict arises when saving to the error folder, you have the following options:

Rename duplicates to 'Duplicate' + consecutive number

The document is renamed "Duplicate" and given a consecutive number, so that the file name stays unique.

Typical use: the document was processed before, and the file name already exists in the error folder.
Overwrite duplicates

The new document overwrites the existing file in the error folder without further checks.

Typical use: the document was processed before, and the file name already exists in the error folder.
Intended file name + consecutive number

The document is filed under the intended name. BarcodeOCR attaches a consecutive number so that the file name stays unique.

Typical use: documents scanned twice should not be overwritten, but also saved in the error folder.

What files in the error folder mean and what you can do about them is described in The error folder.