Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file-glob always returns an empty list
#3
I have done some more investigation with the console. I set up two folders with png files to find; one is the user home folder C:/Users/<my_user> and the other is a test folder in the root of the C: drive C:/test
This is what I got
First looking at the home folder, I simply out in the file search pattern.
> (cdr (file-glob "*.png" 1))
()
> (car (file-glob "*.png" 1))
("image_1920x1080_2025-08-06_11-05-48-22_0000.png" "ticket 2306.png" "ticket 5907.png" "ticket 5908.png" "ticket 5909.png" "ticket 5913.png" "ticket 5927.png")
> (cdar (file-glob "*.png" 1))

("ticket 2306.png" "ticket 5907.png" "ticket 5908.png" "ticket 5909.png" "ticket 5913.png" "ticket 5927.png")


So here it returns a list of files but its not what I expected. The list seems to be all in the head and there is nothing in the tail. The docs say the head contains the list length and tha tail contains the files (I was also expecting full paths not just filenames)

Looking at the test folder, I always get an empty list so it looks like the problem is with the path

> (cdr (file-glob "C:/test/*.png" 1))
()
> (car (file-glob "C:/test/*.png" 1))

()



Next I set up a test folder under the home dir and used a relative path

> (car (file-glob "/test/*.png" 1))
("/test/image_1920x1080_2025-08-06_11-05-48-22_0000.png" "/test/ticket 2306.png" "/test/ticket 5907.png" "/test/ticket 5908.png" "/test/ticket 5909.png" "/test/ticket 5913.png" "/test/ticket 5927.png")

bingo! it's using relative paths based on the user home dir and is ignoring absolute paths. Is this an environment thing or a bug?
Reply


Messages In This Thread
RE: file-glob always returns an empty list - by pyjamaslug - 08-10-2025, 01:54 PM

Forum Jump: