/ Published in: Ruby
Expand |
Embed | Plain Text
puts File.dirname(__FILE__) #Keeps track of where you are at this moment, it might change often puts Dir.pwd #Change Directory #puts Dir.chdir( File.join('', '') ) #An array of info within the directories puts Dir.entries('.') #Code block of files within a directory Dir.entries('.').each do |entry| print entry + ": " if File.file?(entry) && File.readable?(entry) File.open(entry, 'r') do |file| puts file.gets end else puts end end Dir.foreach("."){ |entry| puts entry } Dir.mkdir('temp_directory') Dir.delete('temp_directory')
You need to login to post a comment.
