Test if a directory exists

    0

    14

    filedirectory
    Java Public Recipes

    Check if a directory exists in Java

    import java.io.*;
    
    File f = new File(filePathString);
    if(f.exists() && !f.isDirectory()) { 
        // do something
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.