For every File object you process, you need to determine whether it represents a regular file or a directory. To make this decision, use File.isDirectory().
If it's not a directory, you already know what to do. If it is a directory, you'll need to call File.listFiles() to get an array of File objects contained in the directory.
Note that
you should probably be writing a
recursive method:
1) base case is that File is a regular file
2) recursive case is when File represents a directory