Here you can find the source of copyDirectory(@NotNull String srcDir, @NotNull String dstDir, @NotNull final List
public static void copyDirectory(@NotNull String srcDir, @NotNull String dstDir, @NotNull final List<String> excludes) throws IOException
/*/* w w w . j a va2 s . c o m*/ * Copyright 2013 Matt Sicker and Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import atg.core.util.JarUtils; import atg.tools.dynunit.util.ComponentUtil; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.ObjectInputStream; import java.io.OutputStream; import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; public class Main{ private static final Logger logger = LogManager.getLogger(); public static void copyDirectory(@NotNull String srcDir, @NotNull String dstDir, @NotNull final List<String> excludes) throws IOException { logger.entry(srcDir, dstDir, excludes); Validate.notEmpty(srcDir); Validate.notEmpty(dstDir); final File source = new File(srcDir); if (!source.exists()) { throw logger.throwing(new FileNotFoundException(srcDir)); } final File destination = new File(dstDir); FileUtils.copyDirectory(source, destination, new FileFilter() { @Override public boolean accept(final File file) { return excludes.contains(file.getName()); } }); logger.exit(); } }