fork(1) download
  1. import java.io.*;
  2.  
  3. class Main {
  4. public static void main (String[] args) {
  5. String dirPath = "/home/daniela/oknok/data/uploads/23980dc32e16792007de3343f1f99211/";
  6. System.out.println(dirPath.substring(dirPath.substring(0, dirPath.length() - 1).lastIndexOf("/")));
  7. System.out.println(new File(dirPath).getName());
  8. System.out.println("/" + new File(dirPath).getName() + "/");
  9. }
  10. }
  11.  
  12. //https://pt.stackoverflow.com/q/54733/101
Success #stdin #stdout 0.12s 35812KB
stdin
Standard input is empty
stdout
/23980dc32e16792007de3343f1f99211/
23980dc32e16792007de3343f1f99211
/23980dc32e16792007de3343f1f99211/