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.
- 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
Value | Behavior |
---|---|
"all" | Move all files that matches |
"newest" | Move only the newest file that mathces |
"oldest" | Move only the oldest file that mathces |
Integer value in seconds. Delay for each move operation
Any valid regex expression for standard C++ library std::regex
- From (std::string) => Source directory.
- To (std::string) => Destination directory
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