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!