Move the files in this directory to the new directory.
346873
public void moveThisFile(File file, String strName, String strParentSource)
    {
        if (m_iPass == 1)
        {
            if (!strName.startsWith("ObjectFactory"))
                if (strName.endsWith(".java"))
            {
                if (m_mapClasses.containsKey(strName))
                {
                    if (!SHARED.equals(m_mapClasses.get(strName)))
                    {   // First time, add current entry
                        this.addClassToShared(strName, m_mapClasses.get(strName));
                    }
                    m_mapClasses.put(strName, SHARED);
                    this.addClassToShared(strName, strParentSource);
                }
                else
                {
                    m_mapClasses.put(strName, strParentSource);
                }
            }
        }
        else
        {
            m_bCurrentShared = SHARED.equals(m_mapClasses.get(strName));
            if (m_bCurrentShared)
            {
                strParentSource = ConvertCodePackage.getSharedPackage(strParentSource);
            }
            super.moveThisFile(file, strName, strParentSource);
        }
    }
156396
private void copyBaseDirs(File[] baseDirs) {
        this.baseDirs = new File[baseDirs.length];
        for (int i = 0; i < baseDirs.length; i++) {
            this.baseDirs[i] = baseDirs[i].getAbsoluteFile();
        }
    }
973466
private function renameDirectories(): void
    {
        //update directory names and update file created paths accordingly
        foreach ($this->dirsToRename as $dirPath) {
            $updateDirPath = $this->pathHelper->renamePathBasenameSingularOrPlural(
                $dirPath,
                $this->singularNamespacedName,
                $this->pluralNamespacedName
            );
            foreach ($this->filesCreated as $k => $filePath) {
                $this->filesCreated[$k] = \str_replace($dirPath, $updateDirPath, $filePath);
            }
        }
    }
360200
def do_mkdir(self, path):
        """"""
        path = path[0]

        self.n.makeDirectory(self.current_path + path)
        self.dirs = self.dir_complete()
207909
def update(self):
        

        self._copyfiles = False
        self._updatefiles = True
        self._purge = False
        self._creatdirs = False

        if self._verbose:
            self.log('Updating directory %s with %s\n' %
                     (self._dir2, self._dir1))
        self._dirdiffandupdate(self._dir1, self._dir2)
765673
private void push(File directory) {
		// at this point file is guaranteed to be a directory
		stack.push(workingDirectory);
		workingDirectory = new Directory(directory);
		if (relativePath) {
			pathComponents.push(directory.getName());
		}
	}
142439
def _move_modules(self, temp_repo, destination):
        
        folders = self._get_module_folders(temp_repo)
        for folder in folders:
            force_move(folder, destination)
913509
def make_dir(self):
        """"""
        if not os.path.exists(self.dirname):
            os.makedirs(self.dirname)
276061
def commit(self):
        """"""
        for _, save_dir in self._save_dirs.items():
            save_dir.cleanup()
        self._moves = []
        self._save_dirs = {}
175126
def move_file_to_file(old_path, new_path):
        
        try:
            os.rename(old_path, new_path)
        except:
            old_file = os.path.basename(old_path)
            target_directory, target_file = os.path.dirname(
                os.path.abspath(new_path)), os.path.basename(new_path)
            Document.move_file_to_directory(
                old_path,
                target_directory
            )  # move old file to new directory, change name to new name
            os.rename(os.path.join(target_directory, old_file),
                      os.path.join(target_directory, target_file))
144530
def move(ctx, client, sources, destination):
    """"""
    from renku.api._git import _expand_directories

    dst = Path(destination)

    def fmt_path(path):
        """Format path as relative to the client path."""
        return str(Path(path).absolute().relative_to(client.path))

    files = {
        fmt_path(source): fmt_path(file_or_dir)
        for file_or_dir in sources
        for source in _expand_directories((file_or_dir, ))
    }

    def fmt_dst(path):
        """Build a destination path for a source path."""
        return str(dst / os.path.relpath(path, start=files[path]))

    destinations = {source: fmt_dst(source) for source in files}

    # 1. Check .gitignore.
    ignored = client.find_ignored_paths(*destinations.values())
    if ignored:
        click.echo(WARNING + 'Renamed files match .gitignore.\n')
        if click.confirm(
            'Do you want to edit ".gitignore" now?', default=False
        ):
            click.edit(filename=str(client.path / '.gitignore'))

    # 2. Update dataset metadata files.
    with progressbar(
        client.datasets.items(),
        item_show_func=lambda item: str(item[1].short_id) if item else '',
        label='Updating dataset metadata',
        width=0,
    ) as bar:
        for (path, dataset) in bar:
            renames = {}

            for file in dataset.files:
                filepath = fmt_path(os.path.normpath(str(path.parent / file)))

                if filepath in files:
                    renames[file] = os.path.relpath(
                        destinations[filepath], start=str(path.parent)
                    )

            if renames:
                dataset = dataset.rename_files(
                    lambda key: renames.get(key, key)
                )

                dataset.to_yaml()

    # 3. Manage .gitattributes for external storage.
    tracked = tuple(
        path for path, attr in client.find_attr(*files).items()
        if attr.get('filter') == 'lfs'
    )
    client.untrack_paths_from_storage(*tracked)
    existing = client.find_attr(*tracked)
    if existing:
        click.echo(WARNING + 'There are custom .gitattributes.\n')
        if click.confirm(
            'Do you want to edit ".gitattributes" now?', default=False
        ):
            click.edit(filename=str(client.path / '.gitattributes'))

    client.track_paths_in_storage(*(destinations[path] for path in tracked))

    # 4. Handle symlinks.
    dst.parent.mkdir(parents=True, exist_ok=True)

    for source, target in destinations.items():
        src = Path(source)
        if src.is_symlink():
            Path(target).parent.mkdir(parents=True, exist_ok=True)
            Path(target).symlink_to(
                os.path.relpath(
                    str(src.resolve()), start=os.path.dirname(target)
                )
            )
            src.unlink()
            del files[source]

    # Finally move the files.
    final_sources = list(set(files.values()))
    if final_sources:
        run(['git', 'mv'] + final_sources + [destination], check=True)
152255
public void addDirectory(File dir) {
    File[] ndirs = new File[directories.length + 1];
    System.arraycopy(directories, 0, ndirs, 0, directories.length);
    ndirs[ndirs.length - 1] = dir;
    directories = ndirs;
  }
939633
def run(self):
        """"""
        root_path, folder_name = os.path.split(self.root_folder)
        self.root_folder = os.path.join(root_path, folder_name)
        for dirname, _, fnames in os.walk(self.root_folder):
            self.upload_files_in_folder(dirname, fnames)
1104419
private void addCurrentDirFiles(List<File> theFiles, List<File> theDirs, File currentDir) {
    File dirs[] = currentDir.listFiles(new FileFilter() {

      @Override
      public boolean accept(File file) {
        return file.isDirectory() && !file.getName().startsWith(".") && !file.getName().equals("META-INF");
      }
      
    });
    
    File htmlFiles[] = currentDir.listFiles(new FileFilter() {

      @Override
      public boolean accept(File file) {
        return !file.isDirectory() && file.isFile() && file.canRead() && !file.getName().startsWith(".") && (file.getName().endsWith(".html") || file.getName().endsWith(".htm"));
      }
      
    });
    
    if(dirs != null && dirs.length > 0) {
      theDirs.addAll(Arrays.asList(dirs));
    }
    if(htmlFiles != null && htmlFiles.length > 0) {
      theFiles.addAll(Arrays.asList(htmlFiles));
    }
  }
1003592
def add_files(self, files):
        
        for file in files:
            file.copy(project=self.id)
459890
def _dirdiffcopyandupdate(self, dir1, dir2):
        
        self._dowork(dir1, dir2, self._copy, self._update)
176873
public function moveMigrationFiles()
    {
        $databaseDirectory = base_path('Modules/'.$this->module.'/database');
        if (!$this->files->exists($databaseDirectory.'/migrations')) {
            return;
        }
        $files = $this->files->files($databaseDirectory.'/migrations');
        foreach ($files as $from) {
            $file = basename($from);
            $to = base_path('database/migrations/'.$file);
            $this->files->move($from, $to);
        }
        $this->files->deleteDirectory($databaseDirectory);
    }