String p="\"123456\""; System.out.println(p.substring(1,p.length()-1)); String path ="c:/baseq2/game/*.sav"; String findbase; String findpattern; int i = path.lastIndexOf('/'); if (i!=-1) { findbase = path.substring(0,i); findpattern = path.substring(i+1,path.length()); } else { findpattern = "*"; findbase = path; } System.out.println(findbase + ":" + findpattern);