I am making a simple console application for a home project. Basically, it controls the folder for any added files.
FileSystemWatcher fsw = new FileSystemWatcher(@"c:\temp");
fsw.Created += new FileSystemEventHandler(fsw_Created);
bool monitor = true;
while (monitor)
{
fsw.WaitForChanged(WatcherChangeTypes.Created, 1000);
if(Console.KeyAvailable)
{
monitor = false;
}
}
Show("User has quit the process...", ConsoleColor.Yellow);
When new files appear, WaitForChanges is called and I can get started.
What I need to do is check the file name for the templates. In real life, I put video files in this folder. Based on the file name, I will have rules that move files to specific directories. So, for now, I will have a list of KeyValue pairs ... containing RegEx (I think?) And a folder. So, if the file name matches the regular expression, it moves it to the appropriate folder.
Example file name:
CSI- NY.S07E01.The 34th Floor.avi
, Regex , CSI "AND" (NY "OR" NewYork "" New York "). , \Series\CSI\NY\.
, :
CSI- Crime Scene Investigation.S11E16.Turn On, Tune In, Drop Dead
, NOT. , , CSI, NOT ( "-" "-" "-" )
- RegEx? , , ?