Extracting files from a directory tree
» 06 Oct 2007Mr. Ben Polito has recently beating his drum to the tune that I am a repressed mechanical engineer who needs to release his inner software engineer.
Normally, I am too busy with preparations for the arrival of the Hard Times to spend time busting the myths spread by a sailor in the dark, but a recent problem I ran into at work gave me pause. The first version of our corporate wiki, a tweaked version of mediawiki, left a hierarchy of a few hundred directories sprinkled with around 1600 files. These files were attachments to the old wiki, and while most of them were transferred to the new wiki, some were not.
I thought to myself, “Ah! I bet I could write a little Python function that recursed through the directories, copying out the files and calling itself for each subsequent subdirectory!” This was Friday night around 10, after a day spent writing PLC code for work. It was at this moment that I thought, “Perhaps Mr. Polito has a point.”
To that end, I present Pylito.
blog comments powered by Disqus