It sounds you have some files inside New Folder
tempf = tempd.listFiles();
this line will return null if you have file inside the New Folder check if tempd is directory before listing files inside
tempd = new File(temps);
if (tempd.isDirectory()) {
your code
}