Search code examples
rubyjrubysikulisikuli-ide

Get list of subfolders from a given folder in JRuby


I use JRuby in SikuliX IDE to get list of folders and its subfolders recursively and store its absolute paths(which may contains also dotted characters) in an array. I tried to use following code:

records = Dir.glob 'C:/_private/Files/**/*/'

I got error message:

[error] SyntaxError ( invalid multibyte char (UTF-8) )

Expected output:

C:/_private/Files/dir1
C:/_private/Files/dir1/subdir1
C:/_private/Files/dir1/subdir2
C:/_private/Files/dir2
C:/_private/Files/dir2/subdir1
C:/_private/Files/dir2/subdir2

Solution

  • please check new stuff it producing expected result -

     records = Dir.glob('/E:/ISSUE_Folder/**/*.*')
    
     records.each do |item|
       puts File.dirname(item)
     end
    

    enter image description here

    As you see its going to every folder and sub folder