Reference Replacer

This is a .NET console application that replaces one or more references in file names with those returned from an SQL query.

Detail

A folder containing configuration files is parsed, each configuration file contains a definition describing the location to scan, files to match, how to extract references from them, an SQL query to find replacements and the output file name format. Files are then moved to a destination location with the new name.

Files that don't get references from the SQL query are re-tried for a configurable number of days, before being moved to an expired directory and optionally e-mailed. It is for a very specific use case.

Features

  • Scan multiple locations and file name formats
  • Handle multiple reference replacements in a single file name
  • E-mail expired documents with custom content per file name format
  • E-mail administrators of exceptions
  • Dry run mode logs actions without making changes
  • Multi-threading/process support allows parallel processing of multiple file name formats/locations
  • Runs as a scheduled task allowing flexible scheduling for different file name formats
  • Configuration UI with test utility

Download

License

The Reference Replacer is licensed under version 2.0 of the the Apache License.

Use Case

At work we have documents that are generated with references in the file name. These files are picked up by a DMS for filing. For some documents, the required reference isn't available at the time of document generation. These documents are stored in a holding area with a temporary reference.

A program periodically scans the holding area, extracts the temporary reference and uses it to lookup the correct reference. If found, the file is renamed and moved for the DMS to pick up. The current program works well but is very rigid, only handling a small number of file formats meaning administrators have to request work from a developer to support additional formats.

The Reference Replacer aims to provide a flexible generic solution to this problem, enabling administrators to add/remove file name formats as needed without going back to the developer. It was developed as a learning exercise to explore .NET and Visual Studio so is slightly over-kill for what we need.