Skip to content

Instantly share code, notes, and snippets.

@oogali
Created February 21, 2011 02:47
Show Gist options
  • Save oogali/836604 to your computer and use it in GitHub Desktop.
Save oogali/836604 to your computer and use it in GitHub Desktop.
Quick directory listing
#!/usr/bin/env ruby
while dir = ARGV.shift do
entries = Array.new
dir += '/'
Dir.foreach(dir) { |entry| entries.push entry }
entries.sort.each do |entry|
fn = dir + entry
s = File::stat fn
print entry
print '/' if File.directory? fn
print '@' if s.symlink?
print '=' if not s.file? and not File.directory? fn
puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment