Copy all the files from a directory to the output, compiling
 them if they are familiar to us. Does not do any sprocketing.
512111
def simple_compile_directory(directory)
      if directory.is_a?(String)
        # If we just have a single dirname, assume it's under src
        from_directory = (directory[/\//] ? '' : 'src/') + directory

        directory = {
          :from => from_directory,
          :as => directory
        }
      end

      directory[:use_tilt] |= true

      Dir[@base_dir.join(directory[:from], '**/*')].each do |path|
        file_in_path = Pathname.new(path)

        next unless file_in_path.file?

        file_out_path = remap_path_to_build_directory(path, directory)

        if directory[:use_tilt]
          content = get_compiled_file_content(file_in_path)
          file_out_path = asset_output_filename(file_out_path, Tilt.mappings.keys)
        else
          content = File.read(file_in_path)
        end

        FileUtils.mkdir_p(file_out_path.dirname)
        File.open(file_out_path, 'w') do |f|
          f.write content
        end
      end
    end
1024158
def copy_file(self, src_path, file_name, key=None):
        
        path = os.path.join(self._directories[key], file_name)
        shutil.copyfile(src_path, path)
186759
def copy_file(old, new):
    
    oldp = old.get_fullpath()
    newp = new.get_fullpath()
    log.info("Copying %s to %s", oldp, newp)
    new.create_directory()
    shutil.copy(oldp, newp)
794535
def recursive_copy(src_dir, dest_dir):
  

  file_io.recursive_create_dir(dest_dir)
  for file_name in file_io.list_directory(src_dir):
    old_path = os.path.join(src_dir, file_name)
    new_path = os.path.join(dest_dir, file_name)

    if file_io.is_directory(old_path):
      recursive_copy(old_path, new_path)
    else:
      file_io.copy(old_path, new_path, overwrite=True)
1144109
def write(dir)
      FileUtils.mkdir(dir) unless File.exists?(dir)
      each_item {|guide| write_guide(guide, dir) }
    end
377823
def clone_source_dir(source_dir, dest_dir):
    
    if os.path.isdir(dest_dir):
        print('removing', dest_dir)
        shutil.rmtree(dest_dir)
    shutil.copytree(source_dir, dest_dir)
305586
def recompile_all(path):
    """"""
    import os
    if os.path.isdir(path):
        for root, dirs, files in os.walk(path):
            for name in files:
                if name.endswith('.py'):
                    filename = os.path.abspath(os.path.join(root, name))
                    print >> sys.stderr, filename
                    recompile(filename)
    else:
        filename = os.path.abspath(path)
        recompile(filename)
1157254
def save_files(self):
        """"""
        while True:
            try:
                os.mkdir(self.output_name)
            except Exception as e:
                self.output_name = raw_input("This directory already exists - please enter a new name:")
            else:
                break
        self.workdir = os.getcwd()
        os.chdir(self.workdir+"/"+self.output_name)
315466
def _copy_file_or_directory(self, source, destination_directory):
    
    if os.path.isdir(source):
      for item in os.listdir(source):
        full_source = os.path.join(source, item)
        full_destination = os.path.join(destination_directory, item)
        shutil.copytree(full_source, full_destination)
    else:
      shutil.copy2(source, destination_directory)
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);
    }
1046534
function () {
            var outputDir = path.join(copyDir, jalangiRuntimeDir);
            mkdirp.sync(outputDir);
            var copyFile = function (srcFile) {
                if (jalangiRoot) {
                    srcFile = path.join(jalangiRoot, srcFile);
                }
                var outputFile = path.join(outputDir, path.basename(srcFile));
                fs.writeFileSync(outputFile, String(fs.readFileSync(srcFile)));
            };
            instUtil.headerSources.forEach(copyFile);
            if (analyses) {
                analyses.forEach(function (f) {
                    var outputFile = path.join(outputDir, path.basename(f));
                    fs.writeFileSync(outputFile, String(fs.readFileSync(f)));
                });
            }
        }
131854
def _copy_finfo_directory(finfo, out_dir):
    
    out_dir = _get_dir_upload_path(finfo, out_dir)
    if not shared.up_to_date(out_dir, finfo):
        logger.info("Storing directory in local filesystem: %s" % out_dir)
        if os.path.exists(out_dir):
            shutil.rmtree(out_dir)
        shutil.copytree(finfo["path"], out_dir)
        for tmpdir in ["tx", "tmp"]:
            if os.path.exists(os.path.join(out_dir, tmpdir)):
                shutil.rmtree(os.path.join(out_dir, tmpdir))
        os.utime(out_dir, None)
    return out_dir
80560
def copy_all_lines_from_to(inputFile, outputFile):
    """"""
    currentLine = inputFile.readline()
    while currentLine:
        outputFile.write(currentLine)
        currentLine = inputFile.readline()
1004630
def copy_any(src, dst, only_missing=False):  # pragma: no cover
    """"""
    if not only_missing:
        remove_if_exist(dst)
    if os.path.exists(src):
        if os.path.isdir(src):
            if not only_missing:
                shutil.copytree(src, dst, symlinks=False, ignore=None)
            else:
                for dirpath, filepath in recwalk(src):
                    srcfile = os.path.join(dirpath, filepath)
                    relpath = os.path.relpath(srcfile, src)
                    dstfile = os.path.join(dst, relpath)
                    if not os.path.exists(dstfile):
                        create_dir_if_not_exist(os.path.dirname(dstfile))
                        shutil.copyfile(srcfile, dstfile)
                        shutil.copystat(srcfile, dstfile)
            return True
        elif os.path.isfile(src) and (not only_missing or not os.path.exists(dst)):
            shutil.copyfile(src, dst)
            shutil.copystat(src, dst)
            return True
    return False
789786
def copy_directory(src, dest, force=False):
    ''' 
    '''
    if os.path.exists(dest) and force is True:
        shutil.rmtree(dest)

    try:
        shutil.copytree(src, dest)
    except OSError as e:
        # If the error was caused because the source wasn't a directory
        if e.errno == errno.ENOTDIR:
            shutil.copy(src, dest)
        else:
            bot.error('Directory not copied. Error: %s' % e)
            sys.exit(1)
657782
def copy_resource(self, resource, targetdir):
        """"""
        final_path = resource.final_path()
        if final_path[0] == '/' or (':' in final_path) or ('?' in final_path):
            # Absolute path or URI: Do nothing
            return

        source_path = self.get_source_path(resource)

        if resource.resource_type == DIRECTORY_RESOURCE:
            for file_path in glob.iglob(os.path.join(source_path, '**'), recursive=True):
                if os.path.isdir(file_path):
                    continue
                rest_target_path = file_path[len(source_path)+1:]
                target_path = os.path.join(targetdir, final_path, rest_target_path)
                # Don't yield the result, we don't monitor these.
                self._copy_file(file_path, target_path)
        else:
            target_path = os.path.join(targetdir, final_path)
            yield self._copy_file(source_path, target_path)
388330
public static void copyDirectories(File[] directories, File[] destinationDirectories) throws IOException {
        int length = Integer.min(directories.length, destinationDirectories.length);
        for (int i = 0; i < length; i++) {
            copyDirectory(directories[i], destinationDirectories[i]);
        }
    }