public static void createFile(String content, String urlPath)  
    {  
        /* ָurl */ 
        String[] elems = divUrl(urlPath);  
        StringBuffer path = new StringBuffer();  
 
        File file = null;  
        for (int i = 1; i < elems.length; i++)  
        {  
            if (i != elems.length - 1)  
            {  
 
                path.append(elems[i]);  
                path.append(File.separator);  
                file = new File("D:" + File.separator + path.toString());  
 
            }  
 
            if (i == elems.length - 1)  
            {  
                Pattern pattern = Pattern.compile("\\w+\\.[a-zA-Z]+");  
                Matcher matcher = pattern.matcher(elems[i]);  
                if ((matcher.matches()))  
                {  
                    if (!file.exists())  
                    {  
                        file.mkdirs();  
                    }  
                    String[] fileName = elems[i].split("\\.");  
                    file = new File("D:" + File.separator + path.toString() + File.separator + fileName[0] + ".txt");  
                    try 
                    {  
                        file.createNewFile();  
                        writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));  
                        writer.write(content);  
                        writer.flush();  
                        writer.close();  
                        System.out.println("ļɹ");  
                    } catch (IOException e)  
                    {  
                        e.printStackTrace();  
                    }  
 
                }  
            }  
 
        }  
    }