Java Path Copy nio copyToDir(Path source, Path targetDir, CopyOption... options)

Here you can find the source of copyToDir(Path source, Path targetDir, CopyOption... options)

Description

copy To Dir

License

Open Source License

Declaration

public static void copyToDir(Path source, Path targetDir, CopyOption... options) throws IOException 

Method Source Code

//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);
    }
}

Related

  1. copyRecursively(Path source, Path target, AtomicLong bytesCounter, CopyOption... copyOptions)
  2. copyRecursivelyHelper(Path source, Path target, AtomicLong bytesCounter, CopyOption... copyOptions)
  3. copyResource(String resourceLocation, Path target)
  4. copyResource(String source, Path target, Class cls)
  5. copyResources(final URL source, final Path destination)
  6. copyTree(final Path source, final Path target)
  7. createDirectories(Path currentRestorePath)
  8. createDirectories(Path path, FileAttribute... attrs)
  9. createDirectories(Path thePath, FileAttribute... theAttributes)