File System Scanner
The file system scanner is a collection of scripts hosted on viking which are run on a daily basis to update the 3SDW relational database with the current state of viking's file system.
- Scan the file system to a file
This is a top level script which executes scans of several directory trees. This script needs to be parameterized. The main function of this script is to connect specific directory trees to be scanned to instances of ScannerToFile described below.
This file contains numerous classes to handle the scanning of directory tree contents into various forms. The specific class used is ScannerToFile. Methods of the scanner to file class are called in the doScan.py script. The results of the file system scan are stored in a binary file whose form is defined within the ScannerToFile methods.
- Process the file to the database
This shell script processes the binary scan result files generated in the last step to web services. This shell script contains arguments given to buildHistoryWeb.py
This file parses a file system scan result binary file and publishes the contents to the TSDW web services.
This file contains a class which represents the connection to TSDW web services.
This is the server side code for the web services. There are many web services methods contained within this file but only a few are used for file system scanning. The services utilized in this case are all mapped directly to sql server stored procedures with the same name. Listed below are a description of the web services / stored procedures.
Alters an insert trigger on the FileSystemItem table such that insert/update times are set as the epoch time given in @Timestamp
Sets the Scan bit of all file system item records to 0. As file system items are encountered in the scan result the db record is updated and the scan bit is set to 1. After all scan results have been processed any records which still have a 0 scan bit were not encountered when processing the file scan results.
This plural web service (Item s ) maps to a singular Stored procedure. The stored procedure receives information about the item and sets the item's scan bit to 1. Insert/Update times are managed by triggers. Parameters:
@IsDirectory bit - 1 if this is a directory, 0 if it is a file
@FTPPath varchar(400) = null - The path for the file system item
@Depth int - The depth of the item from root
@FileCount int - If a directory number of files in this directory (does not include sub directories)
@TotalFileSizeBytes bigint - Total number of bytes in this directory (does not include sub directories)
@ModTime bigint - Epoch timestamp representing file modification time.