Previously, I’ve looked up and down the web and haven’t found much information on this topic. I’m looking to implement some ruby code that will scan my hard drive for particular information (telephone numbers for example). I’ve already built several regexs to find what I’m looking for; however, I’m unsure what the core logic to implement them would look like. Any suggestions?
Previously, I’ve looked up and down the web and haven’t found much information on
Share
You should walk the filesystem, recursing for directories, and applying your routine to every file. I’d just use a combination of the find command, starting from your filesystem root, and handing your routine every file. I don’t know how one would use pure ruby to do it, but I look forward to others offering their nuggets of wisdom.
Since you’re using ruby, here’s some (untested) code I found:
It would appear you need the alib gem to run this, let me know how it works out.