say in /Users/timothee/temp/d18_D20200115T203454/ we have symlinks:
ls
total 0
drwxr-xr-x 4 timothee 128 Jan 15 20:43 bar1/
lrwxr-xr-x 1 timothee 4 Jan 15 20:43 bar2 -> bar1/
-rw-r--r-- 1 timothee 0 Jan 15 20:40 foo1.foo2.foo3.log
-rw-r--r-- 1 timothee 0 Jan 15 20:39 foo1.foo2.log
-rw-r--r-- 1 timothee 0 Jan 15 20:35 foo1.log
import pkg/glob
import std/os
proc main()=
# do `ln -s bar1 bar2` inside the dir
let pattern2 = "/Users/timothee/temp/d18_D20200115T203454/bar2/*.log"
echo "walkGlob:"
for file1 in walkGlob(pattern2):
echo (file1: file1)
echo "walkFiles:"
for file2 in walkFiles(pattern2):
echo (file2: file2)
main()
this often occurs in practice, eg on OSX /tmp is a symlink to /private/tmp/:
realpath /tmp
/private/tmp
and walkGlob("/tmp/*.log") doesnt' return anything !
note
the returns files should keep the original name (eg /tmp/, not /private/tmp/), not the realpath names; as is done with all the tools including os.walkDir
/cc @citycide
say in /Users/timothee/temp/d18_D20200115T203454/ we have symlinks:
this produces:
note
this often occurs in practice, eg on OSX
/tmp
is a symlink to/private/tmp/
:and
walkGlob("/tmp/*.log")
doesnt' return anything !note
the returns files should keep the original name (eg
/tmp/
, not/private/tmp/
), not therealpath
names; as is done with all the tools including os.walkDir