Here you can find the source of copyToDir(Path source, Path targetDir, CopyOption... options)
public static void copyToDir(Path source, Path targetDir, CopyOption... options) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2007, 2014 Bruno Medeiros and other Contributors. * 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:/*from w w w .j av a 2 s . co m*/ * Bruno Medeiros - initial implementation *******************************************************************************/ import java.io.IOException; import java.nio.file.CopyOption; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void copyToDir(Path source, Path targetDir, CopyOption... options) throws IOException { Files.copy(source, targetDir.resolve(source.getFileName()), options); } }