Why does the recursive=True lead to finding the same file 10 times.
>>> for g in glob.glob("/home/result/test/**/**/**/*.xml", recursive=True):
... if "testsystems" in g:
... print(f"{g}")
...
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
/home/result/test/foo/bar/test_results/testsystems.xml
According to the docs I expected to need to use recursive=True to support **.
If recursive is true, the pattern “**” will match any files and zero or more directories, subdirectories and symbolic links to directories. If the pattern is followed by an os.sep or os.altsep then files will not match.
source: https://docs.python.org/3.10/library/glob.html
I understand now that I should either use
glob.glob("/home/result/test/**/*.xml", recursive=True)
or to get the expected result
glob.glob("/home/result/test/**/**/**/*.xml")
My main question is why does glob.glob("/home/result/test/**/**/**/*.xml", recursive=True) lead to duplicatus files? And why is it 10?