Skip to content

Latest commit

 

History

History
69 lines (53 loc) · 1.79 KB

README.md

File metadata and controls

69 lines (53 loc) · 1.79 KB

moveFileCron

IFE Coding Challange. (P.S. MVC is not Model-View-Controller in this context)

Transfer files between directories based on the filename. Checked with Regex and transferred periodically.

Usage

  • Compile
cd path/to/sourceCode/moveFileCron #change directory
cmake . #create make file
make #compile
  • Create configuration file (config.json). You can also copy the config.example.json file. The only requirement is that the filename must be config.json
{
  "mode": "all", //Operation mode
  "time": 60, //Timer
  "regex": "cool.*\\.txt", //Regex string to find files
  "directory": {
    "from": "test/temp/destinationPath/", //Destination path
    "to": "test/temp/sourcePath/" //Source path
  }
}
  • Run
./mvc

Configuration

Mode (std::string)

Value Behavior
"all" Move all files that matches
"newest" Move only the newest file that mathces
"oldest" Move only the oldest file that mathces

Time (int)

Integer value in seconds. Delay for each move operation

Regex (std::string)

Any valid regex expression for standard C++ library std::regex

Directory (Json)

  • From (std::string) => Source directory.
  • To (std::string) => Destination directory

How to run tests

The prompt will show all tested functions and if its working well by the default test cases.

cd path/to/sourceCode/moveFileCron/tests #change directory to tests
cmake . #create make file
make #compile
./tests

Third party software