According to the documentation, it appears to me that get_files
should follow symbolic links:
get_files (path, extensions=None, recurse=True, folders=None, followlinks=True)
But I noticed that this is not happening in my setup. In my home
directory I have a symbolic link for a datasets
directory mounted in another disk:
$ ls -la ~/datasets
lrwxrwxrwx. 1 fredguth fredguth 29 Oct 8 21:40
/home/fredguth/datasets -> /run/media/fredguth/datasets/
When I try:
path = Path("/run/media/fredguth/datasets/binary-image-segmentation")
f = get_files(path)
len(f)
It returns 137705
.
But when I try
linkpath = Path("~/datasets/binary-image-segmentation")
lf = get_files(linkpath)
len(lf)
It return 0
.
I also noticed that there is no test for the argument followlinks
:
t3 = get_files(path/'train'/'3', extensions='.png', recurse=False)
t7 = get_files(path/'train'/'7', extensions='.png', recurse=False)
t = get_files(path/'train', extensions='.png', recurse=True)
test_eq(len(t), len(t3)+len(t7))
test_eq(len(get_files(path/'train'/'3', extensions='.jpg', recurse=False)),0)
test_eq(len(t), len(get_files(path, extensions='.png', recurse=True, folders='train')))
t
This behaviour of get_files
also cascades
to get_image_files
(which depends of get_files
).
This seems a bug to me, but I wanted to check it here before posting an issue at the Github repo.