Get the contents of the home directory or directory from where you wish to start. Check if the name is a file or a directory. if it is a directory, go inside it and get its contents. if it is a file check with it.
simple tree traversal funda 🙂
also you can directly execute a command in unix or windows for the same 😉