Hi,
I am searching for a good way to get relative paths of files and (sub)folders within a specific folder.
For my current approach I am using os.walk()
. It is working but it does not seem "pythonic" to me:
myFolder = "myfolder"
fileSet = set() # yes, I need a set()
for root, dirs, files in os.walk(myFolder):
for fileName in files:
fileSet.add(root.replace(myFolder, "") + os.sep + fileName)
Any other suggestions?
Thanks