add filesystem tools and fix foreach in  main.cpp