Skip to content

Instantly share code, notes, and snippets.

@oozzal
Last active December 21, 2015 02:58
Show Gist options
  • Save oozzal/6238248 to your computer and use it in GitHub Desktop.
Save oozzal/6238248 to your computer and use it in GitHub Desktop.
Ruby - working with files and directories.
child_folders = Dir[File.join(path, "*")].select{|file| File.ftype(file) == "directory"}.collect{|name| name.split("/").last}
child_files = Dir[File.join(path, "*")].select{|file| File.ftype(file) == "file"}.collect{|name| name.split("/").last}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment