JOEZACK.COM Code Musings and Such

13Dec/081

Ruby Clipboard Directory List Utility

I wrote this little script to copy the filenames of a directory into the clipboard a while back and forgot to post about it. I've been particularly surprised about how often it's come in handy for this or that.

 require 'clipboard'
 
c = Clipboard.new
 
list = ''
 
if ARGV.size == 0
	path =  "."
else
	path = ARGV[0]
end
 
Dir.foreach(path) {
	|file|
	if(file.length > 2)
		list << file << "\n"
	end
}
 
c.set_data list

To use it, simply call run the script with the directory you want copied to your clipboard as an argument!

Download the code!

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Comments (1) Trackbacks (0)
  1. Using internet is simple as hell. But I can tell y ou right now, it can be very hard, if you are the first time user.
    So, first thing I suggest – open the Explorer, and type in the address you like.
    You’ll get there really fast, it depends on your connection speed.
    Good luck.


Leave a comment

(required)

No trackbacks yet.