The most simple version I use all the time and never had problems with is:
```
ls -1 | wc -l 
```