Ivan Marik wrote:
listFiles may return null if the argument is not a directory, or if its contents cannot be read. At least one of the directories inside C: cannot be read - C:\System Volume Information. Your recursive code encounters this directory eventually. You then try to loop over a null File[], which is causing an NPE.
The solution - check if the result of listFiles is null before looping over it.