public static boolean isRegularFile(Path file){
  try {
    BasicFileAttributes attr=Files.readAttributes(file,BasicFileAttributes.class);
    return (attr.isRegularFile() || attr.isOther()) && !attr.isDirectory();
  }
 catch (  IOException e) {
    return false;
  }
}

public static boolean isRegularFile ( Path file ) { try { BasicFileAttributes attr = Files . readAttributes ( file , BasicFileAttributes . class ) ; return ( attr . isRegularFile ( ) || attr . isOther ( ) ) && ! attr . isDirectory ( ) ; } catch ( IOException e ) { return false ; } }
this is the tmm variant of isregularfiles ( ) < br > because deduplication creates windows junction points , we check here if it is < br > not a directory , and either a regular file or " other " one . < br > see http : / / serverfault . com / a / 667220
