String path = new File("/home/twinuts/mon_fichier").getParent(); System.out.println(path); //affiche /home/twinuts