This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
DUT2Curling/m/ReadFolder.rb
Quentin 761e1e53cb new file: README.md~
new file:   c/ff~
	modified:   c/main.rb
	renamed:    c/ff -> fichier/ff
	new file:   fichier/index.html
	modified:   m/ReadFile.rb
	new file:   m/ReadFolder.rb
2013-12-20 10:27:54 +01:00

21 lines
511 B
Ruby

class String
def liste_rep(espacement = "")
liste_exclus = [".", ".."]
d = Dir.open(self)
liste_dir = d.sort - liste_exclus
liste_dir.each { |fichier|
case File.ftype(self+fichier)
when "directory"
puts "#{espacement} + #{fichier}/"
espacement += " "
(self + fichier + "/").liste_rep(espacement)
espacement = espacement[0, espacement.length-4]
when "file"
puts "#{espacement} - #{fichier}"
end
}
end
end