copyFiles doesn't create empty folders so we need to create them manually
556447
function (directoryNames) {
        var i, directoryName;

        for (i = 0; i < directoryNames.length; i++) {
            directoryName = directoryNames[i];

            mkdirp.sync(directoryName);
            // make output similar to yeoman's
            console.log('   ' + chalk.green('create') + ' ' + directoryName.replace('/', '\\') + '\\');
        }
    }
434898
def make_big_empty_files(self):
        
        for file_url in self.file_urls:
            local_path = file_url.get_local_path(self.dest_directory)
            with open(local_path, "wb") as outfile:
                if file_url.size > 0:
                    outfile.seek(int(file_url.size) - 1)
                    outfile.write(b'\0')
1155491
function copyReadmeFiles() {

    const resolvedSrcReadmePaths = path.resolve(rootDir, srcReadmePaths);

    dryRun ? console.log(`In ${destDir}, this script would...`) : console.log(`In ${destDir}...`);

    fs.readdir('packages', (err, files) => {
        totalDocsCount = files.length;
    });

    createDirectory(destDir);
    glob(resolvedSrcReadmePaths, {realpath:true}, function(error, srcFiles) {
        
        srcFiles.forEach((srcReadmePath) => {    
            createDestReadme(srcReadmePath);
            const srcDirPath = path.dirname(srcReadmePath);
            const lastSrcDir = srcDirPath.split(path.sep).pop();
            sidebarEntries.push(`en/packages/${lastSrcDir}/index`);
        });

        console.log(chalk.green(`${updatedDocsCount} of ${totalDocsCount} package readme.md files updated`));
        updateSidebar();
       
    });

}
184555
def copy_file(self, dest_folder_id, source_file_id, on_duplicate=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - dest_folder_id
        """ID"""
        path["dest_folder_id"] = dest_folder_id

        # REQUIRED - source_file_id
        """The id of the source file"""
        data["source_file_id"] = source_file_id

        # OPTIONAL - on_duplicate
        """What to do if a file with the same name already exists at the destination.
        If such a file exists and this parameter is not given, the call will fail.
        
        "overwrite":: Replace an existing file with the same name
        "rename":: Add a qualifier to make the new filename unique"""
        if on_duplicate is not None:
            self._validate_enum(on_duplicate, ["overwrite", "rename"])
            data["on_duplicate"] = on_duplicate

        self.logger.debug("POST /api/v1/folders/{dest_folder_id}/copy_file with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/folders/{dest_folder_id}/copy_file".format(**path), data=data, params=params, single_item=True)
283487
function copySchemaFiles() {
    const resolvedSrcSchemaPaths = path.resolve(rootDir, srcSchemaPaths);

    glob(resolvedSrcSchemaPaths, void(0), function(error, files) {
        files.forEach((filePath) => {
        const destSchemaPath = filePath.replace(/(\bsrc\b)(?!.*\1)/, destDir);
            fs.copyFileSync(filePath, destSchemaPath);
        });
    });
}
1157108
public static void copyFiles(File[] files, String storageFolder) throws IOException {
        storageFolder = checkFolder(storageFolder) + ValueConsts.SEPARATOR;
        for (File file : files) {
            copyFile(file, new File(storageFolder + file.getName()));
        }
    }
228189
function copydir(from, to, options, callback) {
  if (typeof options === 'function') {
    if(!callback) {
      callback = options;
      options = {};
    }
    options = {
      filter: options
    };
  }
  if(typeof callback !== 'function') {
    callback = function() {};
  }
  if(typeof options.cover === 'undefined') {
    options.cover = true;
  }
  options.filter = typeof options.filter === 'function' ? options.filter : function(state, filepath, filename) {
    return options.filter;
  };
  fs.lstat(from, function(err, stats) {
    if (err) {
      callback(err);
    } else {
      var statsname = stats.isDirectory() ? 'directory' :
        stats.isFile() ? 'file' :
        stats.isSymbolicLink() ? 'symbolicLink' :
        '';
      var valid = options.filter(statsname, from, path.dirname(from), path.basename(from));
      if (statsname === 'directory' || statsname === 'symbolicLink') {
        // Directory or SymbolicLink
        if(valid) {
          fs.stat(to, function(err) {
            if(err) {
              if(err.code === 'ENOENT') {
                fs.mkdir(to, function(err) {
                  if(err) {
                    callback(err);
                  } else {
                    options.debug && console.log('>> ' + to);
                    rewrite(to, options, stats, function(err) {
                      if(err) {
                        callback(err);
                      } else {
                        listDirectory(from, to, options, callback);
                      }
                    });
                  }
                });
              } else {
                callback(err);
              }
            } else {
              rewrite(to, options, stats, function(err) {
                if(err) {
                  callback(err);
                } else {
                  listDirectory(from, to, options, callback);
                }
              });
            }
          });
        } else {
          callback();
        }
      } else if(stats.isFile()) {
        // File
        if(valid) {
          if(options.cover) {
            writeFile(from, to, options, stats, callback);
          } else {
            fs.stat(to, function(err) {
              if(err) {
                if(err.code === 'ENOENT') {
                  writeFile(from, to, options, stats, callback);
                } else {
                  callback(err);
                }
              } else {
                callback();
              }
            });
          }
        } else {
          callback();
        }
      } else {
        callback(new Error('stats invalid: '+ from));
      }
    }
  });
}
172046
function copyFiles(dir) {
    var files = fs.readdirSync(srcDir + dir);
    files.forEach(function(file) {
      var currentDir = dir + file;
      if (!regexExcludeFiles.test(currentDir)) {
        var stats = fs.statSync(srcDir + currentDir);
        if (stats.isDirectory()) {
          if (!fs.existsSync(publishDir + currentDir)) {
            fs.mkdirSync(publishDir + currentDir);
          }
          copyFiles(currentDir + "/");
        } else if (stats.isFile()) {
          var contents = fs.readFileSync(srcDir + currentDir);
          fs.writeFileSync(publishDir + currentDir, contents);
        }
      }
    });
  }
642608
public static void copyFolder(String sourcePath, String targetPath, final String filterName,
         final boolean recursive) throws IOException
   {
      File path = new File(targetPath);
      if (!path.exists())
      {
         if (!path.mkdirs())
            throw new IOException("outdir can't be created");
      }
      File a = new File(sourcePath);
      String[] fileNames = a.list(new FilenameFilter()
      {
         public boolean accept(File dir, String fname)
         {
            if (new File(dir, fname).isDirectory())
            {
               return true;
            }
            else
            {
               return fname.endsWith(filterName);
            }
         }

      });
      File jarFile = null;
      if (fileNames != null)
      {
         for (String fileName : fileNames)
         {
            jarFile = new File(sourcePath + File.separator + fileName);

            if (jarFile.isFile())
            {
               copyFile(jarFile, targetPath);
            }
            if (recursive && jarFile.isDirectory())
            {
               copyFolder(sourcePath + File.separator + fileName, targetPath + File.separator + fileName, filterName,
                     recursive);
            }
         }
      }
   }
101421
function copyFiles(g, defaultOutputDir, targetDir) {
            var files = glob.sync(g.src.toString(), {cwd: g.cwd, root: '/'});
            files.forEach(function (file) {
                var destinationDirectory = defaultOutputDir + path.sep + targetDir;
                var fileDirectory = path.dirname(file);
                if (fileDirectory !== '.') {
                    destinationDirectory = destinationDirectory + path.sep + fileDirectory;
                }
                fs.mkdirpSync(destinationDirectory);
                var source = path.resolve(g.cwd, file);
                var extension = path.extname(file);
                var destination;
                if (targetDir === 'test') {
                    var base = path.basename(file, extension);
                    if (extension === '.js') {
                        destination = destinationDirectory + path.sep + path.basename(base.replace(/\./g, '_') + extension);
                    } else if (extension === '.feature') {
                        destination = destinationDirectory + path.sep + path.basename(base.concat(extension).replace(/\./g, '_') + '.js');
                    }
                } else {
                    destination = destinationDirectory + path.sep + path.basename(file);
                }

                fs.copySync(source, destination, {replace: true});
            });
        }
530569
def copy_folder_content(src, dst):
    
    for file in os.listdir(src):
        file_path = os.path.join(src, file)
        dst_file_path = os.path.join(dst, file)
        if os.path.isdir(file_path):
            shutil.copytree(file_path, dst_file_path)
        else:
            shutil.copyfile(file_path, dst_file_path)
801661
def copy_to_folder(self, parent, name=None, api=None):
        
        api = api or self._API

        if self.is_folder():
            raise SbgError('Copying folders is not supported')

        data = {
            'parent': Transform.to_file(parent)
        }

        if name:
            data['name'] = name

        response = api.post(
            url=self._URL['copy_to_folder'].format(file_id=self.id),
            data=data
        ).json()
        return File(api=api, **response)
993481
public static void copyDirs(Path source, Path target, CopyOption... options) throws IOException {
        if (Files.notExists(target)) {
            Files.createDirectory(target);
        }

        logger.debug("  --> Copying resources from [{}]", source);
        if (Files.notExists(source)) {
            throw new RuntimeException(source + " doesn't seem to exist.");
        }

        Files.walkFileTree(source, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE,
                new InternalFileVisitor(source, target, options));

        logger.debug("  --> Resources ready in [{}]", target);
    }
1054073
function copyFiles(srcfile, dstfile, callback) {
        var fs = require("fs");
        var rs = fs.createReadStream(srcfile);
        var ws = fs.createWriteStream(dstfile);
        rs.on("data", function(d) {
            ws.write(d);
        });
        rs.on("end", function() {
            ws.end();
            callback(true);
        });
    }
13610
def recursive_generate_copy_in(copy_in, current_path)
      limited_files_of(current_path) { |file| copy_in << file }
      directories_of(current_path) do |dir|
        recursive_generate_copy_in(copy_in, ::File.join(dir))
      end
      true
    end
413614
def copy_files_to_folder(src, dest, xtn='*.txt'):
	 
	
	try:
		all_files = glob.glob(os.path.join(src,xtn))
		for f in all_files:
			copy_file(f, dest)
	except Exception as ex:
		print('ERROR copy_files_to_folder - ' + str(ex))
389433
function createFiles (num, dir) {
  for (var i = 0; i <= num; i++) {
    fs.writeFileSync(path.join(dir, 'test-' + i + '.txt'), String(i));
  }
}