I am trying to count the number of files in a directory. This program counts the number of photos of a person. The person's name is used as the file's name.
Here is the full file path
C:\Users\barry\PycharmProjects\face_rec\images\Barry
I have looked at How to count the number of files in a directory using Python and came up with this solution:
numberOfFile=(len([filename for filename in os.listdir('images/'+name.get()) if os.path.isfile('images/'+name.get())]))
print(numberOfFile)
However this solution always returns 0
I would like to avoid using the absolute path, but if the only option is using the absolute path, that is fine.