I frequently scribble that kind of psuedo code out to start a problem. What's fun is to translate to code line per line. I haven't compiled or checked this but consider ...
That's pretty near one-to-one with the sketch from before. Your logic is actually better because it allows the first "source" argument to be a file or directory. For fun try to make it this expressive and keep that feature.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus