mv_retain_folder

Preserves the directory structure of files in the input folder tree.

Member of namespace

mvscan

Syntax

mv_retain_folder(bool bRetainFolders)

Returns

Always True.

Level

Batch level.

Parameters

bRetain
Set to True to enable this option, default is False.
bRetainFolders
A boolean value that enables or disables preserving the directory structure.
True

If and when an input file is moved to the Problem or Copy folders, the path relative to the base input folder is reproduced within the Problem or Copy folder.

False

Input files are placed directly in the Problem or Copy folder as appropriate. The relative path within the input folder is only retained in the ScanSrcPath variable.

If the option is enabled, the Problem and Copy folders are populated with subfolders to match the path of the input files relative to the root input folder. If retain folders is set to False, then the copied files are placed in the root of the copy directory, regardless of the original subfolder where they were located in the scan directory.

Additionally, the following variables are added to the page to allow the application to determine the path of the input file:

Variable Description Example
ScanSrcInputFolder The full path of the root input folder for this file. It does not include the file name. For more information, see ScanSrcInputFolder. c:\shared\group1
ScanSrcSubFolder The relative path of the input folder in which the file was found, which includes the root input folder name but not the root folder path. For more information, see ScanSrcSubFolder. \shared\group1\batch1
ScanSrcFileName The original filename without the path. For more information, see ScanSrcFileName. invoice_0001.tif

Directory structure when Retain is enabled

When the folder directory is retained, the copy directory includes the source directory as the root within the copy directory. A sample set of input directories and how they appear in the copy directory after scan has completed, is illustrated below.

This example assumes the following actions were used:

set_folder("C:\Datacap\MyApplication\Input")
        set_copy_folder("C:\Datacap\MyApplication\Done")
Files as they existed in the scan directory:
C:\Datacap\MyApplication\Input\Sub1\File1.tif
        C:\Datacap\MyApplication\Input\Sub1\File2.tif
        C:\Datacap\MyApplication\Input\Sub1\Sub2\File3.tif
        C:\Datacap\MyApplication\Input\Sub3\File4.tif
        C:\Datacap\MyApplication\Input\File5.tif

Files as they exist after multiple scans to ingest all of the files:

C:\Datacap\MyApplication\Done\Input\Sub1\File1.tif
        C:\Datacap\MyApplication\Done\Input\Sub1\File2.tif
        C:\Datacap\MyApplication\Done\Input\Sub1\Sub2\File3.tif
        C:\Datacap\MyApplication\Done\Input\Sub3\File4.tif
        C:\Datacap\MyApplication\Done\Input\File5.tif
Example
set_folder(“c:\scan\group1\Input|c:\scan\group2\Input|d:\scan\group3\Input”)
set_copy_folder(“Done”)
set_problem_folder("Error")
mv_retain_folder(True)
scan()
In this example, the set_folder action specifies three input folders. The following table shows the copy and problem folders for each input folder:
Input folder Copy folder Problem folder
c:\scan\group1\Input c:\scan\Done c:\scan\Error
c:\scan\group2\Input c:\scan\Done c:\scan\Error
d:\scan\group3\Input d:\scan\Done d:\scan\Error
Within the copy or problem folder, files are placed in a directory structure that replicates the file’s original input folder except for the root input folder. The following table shows some examples:
Input folder file placement Copy folder placement Problem folder placement
c:\scan\group1\input\f1.tif c:\scan\group1\done\input\f1.tif c:\scan\group1\error\input\f1.tif
d:\scan\group3\input\f2.tif c:\scan\group3\done\input\f2.tif d:\scan\group3\error\input\f2.tif