Ruby script to sort articles by word count (good for large collections of PLR)

FatherCarbon

Registered Member
Joined
Sep 30, 2008
Messages
96
Reaction score
63
I whipped up this ruby script tonight to sort through all of my PLR and move all of the articles that did not meet the minimum word count to another folder.

There's not much else I can say about it really, just a simple tool for a simple job and I thought some of you might find it useful.

Everything you need to know is in the comments at the beginning of the file.

This should work on any system that can run Ruby. (Linux, Windows, etc)
Please note that I've only tested it on Linux though.

If you don't have the ruby interpreter, get it here:

http://www.ruby-lang.org/en/downloads/

-------------------------------------------------------------------------------------------------
Here's a quick rundown:

ruby words.rb /articles 400

Moves all files in /articles with a wordcount less than 400 to /articles/Under400
-------------------------------------------------------------------------------------------------

Enjoy! :D
 

Attachments

UPDATE

For some unknown reason I didn't put in the simple ability to display the wordcount.

So, here is the updated version that displays the wordcount and quits when used with the 'count' parameter.

USAGE:
ruby word.rb count /articles/prostitutiononthecheap.txt

LINUX HINT
If you're in Linux, remove the .rb extension and chmod +x it, then just:
./word count /articles/polesitting.txt

NOTE: It still has the same functionality as before to sort articles. :P
 

Attachments

Is this for windows or linux?


This message is too short.... :P
 
Is this for windows or linux?

Both, since ruby runs on both operating systems. Honestly though, I haven't tested it on Windows since I don't have a copy installed (except my XP virtual machine, but it's screwed up for some reason).

If you or anyone tries this in Windows, please report your results here. I don't see why it wouldn't work though. Ruby is beautiful like that. ;)
 
It's perfect, thank you!! This will save me a lot of time sorting through articles for word count.

ps I'll test on Windows and report soon.
 
great going fathercarbon
i just love it when ppl make their own scripts/software, maybe cause i have been experimenting on python a lot myself lately lol
 
I've come to believe, after trying so many blackhat tools, that the only way to have a truly satisfactory product is to make it yourself. :D
 
Back
Top