How does java generate folders according to the path?

for example, if the path is / csrSystemXYK/src/com/sunyard/csr/action/
, then create a folder?

Jun.02,2021

it is recommended to use Path class to manipulate files, involving advanced features such as file listening events, file permissions, etc.
the following is found casually on the blog, things are quite miscellaneous, and you need to read API

for yourself.
package filespaths;
import org.junit.Test;
import java.io.*;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
/**
 * @Author kingboy
 * @Date 2017/4/13 11:05
 * @Description Path is used to Path Sample
 * @email kingboyworld@163.com
 */
public class PathTest {
  private static String separator = File.separator;
  /**
   * Path
   */
  @Test
  public void constructon(){
    //1.Paths
    Path path = Paths.get("/Users/kingboy/Desktop/");
    Path path1 = Paths.get(URI.create("/Users/kingboy/Desktop/"));
    //2.FileSystems
    Path path2 = FileSystems.getDefault().getPath("/Users/kingboy/Desktop/");
    //3.File
    Path path3 = new File("/Users/kingboy/Desktop/").toPath();
  }
  /**
   * /
   * @throws IOException
   */
  @Test
  public void create() throws IOException {
    //
    Path path = Paths.get("/Users/kingboy/Desktop/hello");
    if(!Files.exists(path)){
      Files.createDirectory(path);
      //
      //Files.createDirectories(path);
    }
    //
    Path path1 = Paths.get("/Users/kingboy/Desktop/helloFile");
    if(Files.exists(path1)){
      Files.createFile(path1);
    }
  }
  /**
   * 
   */
  @Test
  public void getFileProperties() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/text.txt");
    System.out.println(Files.getLastModifiedTime(path));//
    System.out.println(Files.getOwner(path));//
    System.out.println(Files.getPosixFilePermissions(path));//
    System.out.println(Files.size(path));//
  }
  /**
   * 
   */
  @Test
  public void readText() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/text.txt");
    //bufferedReader
    BufferedReader bufferedReader = Files.newBufferedReader(path, StandardCharsets.UTF_8);//
    StringBuilder sb = new StringBuilder();
    String tempString = null;
    while ((tempString = bufferedReader.readLine())!=null){
      sb = sb.append(tempString);
    }
    System.out.println(sb);
    //FilesreadAllLines
    List<String> strings = Files.readAllLines(path);
    strings.forEach(s -> System.out.print(s));
    //
    //adsfasdfasdfadsfasdfgsdfsdffsdfsdf
    //adsfasdfasdfadsfasdfgsdfsdffsdfsdf
  }
  /**
   * 
   * @throws IOException
   */
  @Test
  public void getInputStream() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/text.txt");
    InputStream inputStream = Files.newInputStream(path);
  }
  /**
   * 
   */
  @Test
  public void writeFile() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/writeFile");
    BufferedWriter bufferedWriter = Files.newBufferedWriter(path);
    String str = "write file test";
    bufferedWriter.write(str);
    bufferedWriter.flush();
    bufferedWriter.close();
  }
  /**
   * 
   */
  @Test
  public void traverseDirectory() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/");
    Stream<Path> list = Files.list(path);
    list.forEach(p -> {
      System.out.println(p.getFileName());
    });
  }
  /**
   * 
   */
  @Test
  public void traverseTree() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/");
    Stream<Path> walk = Files.walk(path);
    walk.forEach(path1 -> {
//      System.out.println(path1.getRoot());//
      System.out.println(path1.getFileName());//
//      System.out.println(path1.getParent());//
//      System.out.println(path1.getFileSystem());//
    });
    //Files.walkFileTree()
  }
  /**
   * 
   */
  @Test
  public void copyFile() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/text.txt");
    Path path2 = Paths.get("/Users/kingboy/Desktop/hello.txt");
    Files.copy(path,path2);
  }
  /**
   * 
   */
  @Test
  public void writePermission() throws IOException {
    Path path = Paths.get("/Users/kingboy/Desktop/text.txt");
    Set<PosixFilePermission> permissionSet = new HashSet<>();
    permissionSet.add(PosixFilePermission.GROUP_WRITE);
    permissionSet.add(PosixFilePermission.OWNER_EXECUTE);
    Files.setPosixFilePermissions(path,permissionSet);
  }
  //Api,
 }

    // 
    File file = new File("/csrSystemXYK/src/com/sunyard/csr/action/");

    if (!file.exists())
    {
        file.mkdir();
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b4011d-2c4d9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b4011d-2c4d9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?