modified to allow hidden files and folders (ie-begins with '.')