Does anybody know how to get the totall amount of files on a machine? Without searching for them 1 by 1.

Im making a progress bar that gets the # of files on your computer, and then scans them giving the user the progress. But i cant find a way without looking for all the files on the computer first and counting them.
HELP!

Thanks in advance!