Louis I. answered 06/18/19
Computer Science Instructor/Tutor: Real World and Academia Experienced
I'm afraid I don't quite understand what your intention is here ... sounds like you're just trying to count the number of regular files under a given directory path,
So what's the problem?
This is how I counted all files under my /tmp/*
$ find /tmp -type f | wc -l
97
Here's what the first several file paths look like
$ find /tmp -type f |
/tmp/.bash-fc-4284816303.swp
/tmp/.name.swp
/tmp/.RR.swp
/tmp/.xx.swp
/tmp/1
/tmp/3
/tmp/330
/tmp/490
/tmp/AK
/tmp/AK.err
/tmp/Chris/packup
/tmp/Chris/sftpfile
/tmp/Chris/sub1/12