-
-
Save latpaw/3012430 to your computer and use it in GitHub Desktop.
递归遍历文件夹
This file contains 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
def yue(dir) | |
Dir::foreach(dir) do |file| | |
if file.eql? "." or file.eql? ".." | |
nil | |
else | |
if File.directory? dir+"/"+file | |
yue(dir+"/"+file) | |
else | |
puts dir+"/"+file | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment