Java File Exist fileExist(String cmdPath)

Here you can find the source of fileExist(String cmdPath)

Description

Checks whether a file exists.

License

Open Source License

Parameter

Parameter Description
cmdPath The file path to be checked.

Return

true if the file exists, false otherwise.

Declaration

public static boolean fileExist(String cmdPath) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009-2010 Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://w  w w . j  av  a  2s.  c o m
 *     Red Hat - initial API and implementation
 *******************************************************************************/

import java.io.File;

public class Main {
    /**
     * Checks whether a file exists.
     *
     * @param cmdPath The file path to be checked.
     * @return <code>true</code> if the file exists, <code>false</code> otherwise.
     */
    public static boolean fileExist(String cmdPath) {
        return new File(cmdPath).exists();
    }
}

Related

  1. doesExist(String fname)
  2. doesExistsInside(File src, String fileName)
  3. fileExist(String _FileName, String _Path)
  4. fileExist(String p_filename)
  5. fileExist(String path)
  6. fileExists(File dir, String regex)
  7. fileExists(File directory, String fileName)