This python script will monitor a directory for files with names that match patterns specified and move to a target directory
The default files used are:
- pattern_file.py - each line should be a file pattern for files that will be moved. For example, ".xml" for XML files or "something_.xls" for a more specific name.
- ignore_file.py - each line should be a file pattern for files that will be ignored. For example, "*.lock" to ignore git locks or ".DS_Store" for mac devices.
If the folder you're running this code in is managed by git, there can be some funny behavior when it comes to lock files. For this reason the default ignore_pattern.txt file includes *.lock to ignore lock files.
I tested the code using files in a separate directory. You can pass the directory that is to be monitored in the first argument.
python pattern_watch.py "directory_to_watch" "target_directory" pattern_file ignore_file