//Check whether the given pathname is drive or not if(FileSystemView.getFileSystemView().isDrive(myFile)) { System.out.println("This is a drive"); } else { System.out.println("This is not a drive"); } }}