Created
February 21, 2011 02:47
-
-
Save oogali/836604 to your computer and use it in GitHub Desktop.
Quick directory listing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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