I was talking about the first example
and I saw others examples too and they give the path + the file’s extension and not the whole file name with extension
which is very strange the doc seems to indicate that it should give full filename
but I don’t get it
may be because it is not the same python lib that blender use !
Please try to be more specific and illustrate what you mean with screenshots, console output and examples. The words ‘full file name’ may refer to the file name with or without the path. Something like ‘C:\SomeDirectory\someFile.txt’ is considered to be a ‘full file name’, however sometimes ‘full file name’ may reffer to only ‘someFile.txt’. Both meanings are valid and depend on the context…
This code:
import os
files = []
directories = []
for i in os.listdir():
if os.path.isdir(i):
directories.append(os.path.abspath(i))
elif os.path.isfile(i):
files.append(os.path.abspath(i))
print('\n\n\nDirectories:\n ' + '\n '.join(directories))
print('\nFiles:\n ' + '\n '.join(files))
And then with os.walk you can walk the directory tree so this code:
import os
files=[]
directories=[]
for root, dirs, filenames in os.walk(os.getcwd()):
for every_file in filenames:
files.append(os.path.join(root, every_file))
for every_dir in dirs:
directories.append(os.path.join(root, every_dir))
print('\n\n\nDirectories:\n ' + '\n '.join(directories))
print('\nFiles:\n ' + '\n '.join(files))