How to get the files inside a directory link with python

279 Views Asked by At

This is probably super easy, but after an hour of trying, I haven't been able to find it.

From a specific folder inside a database called /Database/Images/, I manually created a folder link with Windows and placed it at, /Tests/Images.

With that done, I created a python script inside the /Tests folder and I'm trying to use it to access the files inside that /Tests/Images link.

How can I get the data inside /Database/Images/ from the link /Tests/Images?

The problem is that I can't use os.listdir(), because it is not a directory, but I also can't seem to find the way to know that /Tests/Images is actually pointing to /Database/Images/

So far I've tried several os function but

  • os.listdir() returns that /Tests/Images is not a directory
  • os.path.islink() returns False
  • os.path.realpath() and os.path.abspath() returns /Tests/Images, not /Database/Images/
0

There are 0 best solutions below