What do you mean by a duplicate file - a file with the same name or a file with the same name and same content ?
If the former you can use the File, FilenameFilter and FileFilter classes to list all the files in a directory with a given name. If you need to check the content as well, then you need to look at the Java I/O tutorial.
Nobody here will just give you the code, you need to show some effort. Hava a look at the suggestions above and then see what you can come up with. If you have any problems show us what you have tried and give us full details of the problem. See the HowToAskQuestionsOnJavaRanch FAQ for more details.