Here you can find the source of getPath(final String fullFileName)
Parameter | Description |
---|---|
fullFileName | String the full file name |
public static String getPath(final String fullFileName)
//package com.java2s; /************************************************************************** * <pre>/*from w w w . j a va 2s .c o m*/ * * Copyright (c) Unterrainer Informatik OG. * This source is subject to the Microsoft Public License. * * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL. * All other rights reserved. * * (In other words you may copy, use, change and redistribute it without * any restrictions except for not suing me because it broke something.) * * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR * PURPOSE. * * </pre> ***************************************************************************/ import java.nio.file.Paths; public class Main { /** * Returns the path (without the file-name) for a filename with path. * * @param fullFileName {@link String} the full file name * @return the path as a string */ public static String getPath(final String fullFileName) { return Paths.get(fullFileName).getParent().toString(); } }