lundi 30 mars 2015

Why does Dir#glob not populate my variable on Windows?

I have the following Ruby script which is supposed to insert the names of the files into the contents array:



filelist = Dir.glob('C:\Users\abc\Desktop\drg\*.*')
print filelist
filelist.each do |filepathname|
contents = IO.read(filepathname)
puts contents
end


For the above code, I get no output for filelist or contents. Why is that?


Aucun commentaire:

Enregistrer un commentaire