MEMO/Java-memo

해당 디렉토리에 있는 모든 filelist를 가져오는 코드

hingu 2024. 5. 22. 11:42

서버에 업로드시 동일한 이름이 이미 있을 경우 해당 부분을 조건문으로 처리하여 다른이름으로 저장되도록 하기 위해 사용

public void directory() throws Exception{
    String url = "D:\\product\\";
    File f = new File(url);
    File allfile[] = f.listFiles();
    System.out.println(Arrays.asList(allfile));
}