Get names of all files from a folder with Ruby

后端 未结 19 2355
[愿得一人]
[愿得一人] 2020-11-29 14:57

I want to get all file names from a folder using Ruby.

19条回答
  •  粉色の甜心
    2020-11-29 15:51

    The following snippets exactly shows the name of the files inside a directory, skipping subdirectories and ".", ".." dotted folders:

    Dir.entries("your/folder").select { |f| File.file? File.join("your/folder", f) }
    

提交回复
热议问题