Moves file from old location to new one

        :param old_path: path of file to move
        :param new_path: new path
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))
1238124
def __update_cleanup_paths(new_path):
    
    cleanup_dirs = settings.CFG["cleanup_paths"].value
    cleanup_dirs = set(cleanup_dirs)
    cleanup_dirs.add(new_path)
    cleanup_dirs = list(cleanup_dirs)
    settings.CFG["cleanup_paths"] = cleanup_dirs
274243
def move(self, target):
        
        shutil.move(self.path, self._to_backend(target))
94402
public function move(string $old, string $new){
    if (
      !empty($old) &&
      !empty($new) &&
      ($old = $this->checkFilePath($old)) &&
      ftp_rename($this->cn, $old, $new)
    ){
      return true;
    }
    return false;
  }
1305923
def set_path(self, file_path):
        
        if not file_path:
            self.read_data = self.memory_read
            self.write_data = self.memory_write
        elif not is_valid(file_path):
            self.write_data(file_path, {})

        self.path = file_path
689050
def in_path(self, new_path, old_path=None):
        """"""
        self.path = new_path
        try:
            yield
        finally:
            self.path = old_path
62600
def add_to_path(p):
    '''
        
    '''
    old_path = sys.path
    if p not in sys.path:
        sys.path = sys.path[:]
        sys.path.insert(0, p)
    try:
        yield
    finally:
        sys.path = old_path
864315
def on_moved(self, event):
        
        logger.debug("file moved: %s -> %s", event.src_path, event.dest_path)
        if not event.is_directory:
            self.update_file(event.dest_path)
359543
public boolean moveToTrashAsOwner(Path path) throws IOException {
    String owner = this.fs.getFileStatus(path).getOwner();
    return moveToTrashAsUser(path, owner);
  }
1193262
def newFile(self, *path):
        
        assert len(path) > 0, "newFile requires a nonzero number of segments"
        if self.dbdir is None:
            if self.filesdir is None:
                raise RuntimeError("This in-memory store has no file directory")
            else:
                tmpbase = self.filesdir
        else:
            tmpbase = self.dbdir
        tmpname = tmpbase.child('temp').child(str(tempCounter.next()) + ".tmp")
        return AtomicFile(tmpname.path, self.newFilePath(*path))
389121
def move(self, source, destination):
        
        if source.isfile():
            source.copy(destination)
            source.remove()
        else:
            source.copy(destination, recursive=True)
            source.remove('r')
777394
def rename(path):
    """"""

    new_path = prompt(path)

    if path != new_path:
        try:
            from shutil import move
        except ImportError:
            from os import rename as move

        move(path, new_path)

    return new_path
460186
def rename_dont_move(self, path, dest):
        
        self.move(path, dest, raise_if_exists=True)
1141890
def replace_in_file(self, file_path, old_exp, new_exp):
        
        self.term.print_info(u"Making replacement into {}"
                                 .format(self.term.text_in_color(file_path,
                                                                 TERM_GREEN)))
        # write the new version into a temporary file
        tmp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
        for filelineno, line in enumerate(io.open(file_path, encoding="utf-8")):
            if old_exp in line:
                line = line.replace(old_exp, new_exp)
            try:
                tmp_file.write(line.encode('utf-8'))
            except TypeError:
                tmp_file.write(line)

        name = tmp_file.name # keep the name
        tmp_file.close()
        shutil.copy(name, file_path) # replace the original one
        os.remove(name)
497240
def change_directory(path=None):
    
    if path is not None:
        try:
            oldpwd = getcwd()
            logger.debug('changing directory from %s to %s' % (oldpwd, path))
            chdir(path)
            yield
        finally:
            chdir(oldpwd)
    else:
        yield
1077779
def move(self, key, folder):
        
        # Basically this is a sophisticated __delitem__
        # We need the path so we can make it in the new folder
        path, host, flags = self._exists(key)
        self._invalidate_cache()

        # Now, move the message file to the new folder
        newpath = joinpath(
            folder.base, 
            folder.get_name(), 
            "cur",     # we should probably move it to new if it's in new
            basename(path)
            )
        self.filesystem.rename(path, newpath)
        # And update the caches in the new folder
        folder._invalidate_cache()
175376
def rebase(image)
      new_path = @router.baseline_dir(image.name)

      create_path_for_file(new_path)
      FileUtils.move(image.path, new_path)

      Monet::Image.new(new_path)
    end