Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

in Following code, metadata_files not returning [] but there is lots of file there, any idea/suggestion

here temp_dir is /tmp and METADATA_FILE_EXTENSION = .metadata so lot of .metadata file , nested inside /tmp

metadata_files = Dir.glob(File.join(temp_dir, "**" "*#{METADATA_FILE_EXTENSION}"))
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
272 views
Welcome To Ask or Share your Answers For Others

1 Answer

You are missing a comma between "**" and "*#{METADATA_FILE_EXTENSION}", so the strings are getting combined too early ("a" "b" == "ab")

here is your original code for building the path:

temp_dir = "/tmp"
METADATA_FILE_EXTENSION = ".metadata"
puts File.join(temp_dir, "**" "*#{METADATA_FILE_EXTENSION}")
# => /tmp/***.metadata

and fixed:

temp_dir = "/tmp"
METADATA_FILE_EXTENSION = ".metadata"
puts File.join(temp_dir, "**", "*#{METADATA_FILE_EXTENSION}")
# => /tmp/**/*.metadata

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...