Move files and folders
502743
function renameFilesIOS (oldPackageName, newPackageName) {
  const filesAndFolders = [
    `ios/${oldPackageName}.xcodeproj/xcshareddata/xcschemes/<?>-tvOS.xcscheme`,
    `ios/${oldPackageName}.xcodeproj/xcshareddata/xcschemes/<?>.xcscheme`,
    'ios/<?>.xcodeproj',
    `ios/${oldPackageName}/<?>.entitlements`,
    'ios/<?>',
    'ios/<?>-tvOS',
    'ios/<?>-tvOSTests',
    `ios/${oldPackageName}Tests/<?>Tests.m`,
    'ios/<?>Tests',
    'ios/<?>.xcworkspace',
  ]

  for (let i = 0; i < filesAndFolders.length; i++) {
    const element = filesAndFolders[i]
    const srcFile = fullPath(element.replace('<?>', oldPackageName))

    console.log(`From ${relative(srcFile)}`)
    if (fs.existsSync(srcFile)) {
      const destFile = fullPath(element.replace('<?>', newPackageName))

      fs.renameSync(srcFile, destFile)
      console.log(`  to ${relative(destFile)}`)
    } else {
      console.log(`${srcFile} does not exists.`)
    }
  }
}
389121
def move(self, source, destination):
        
        if source.isfile():
            source.copy(destination)
            source.remove()
        else:
            source.copy(destination, recursive=True)
            source.remove('r')
696790
public void moveThisFile(File fileSource, File fileDestDir, String strDestName)
    {
        fileDestDir.mkdirs();
        String strNewDir = this.getNewCalendarPath(fileSource);
        if (strNewDir != null)
        {
            fileDestDir = new File(fileDestDir, strNewDir);
            fileDestDir.mkdirs();
        }
        File fileDest = new File(fileDestDir, strDestName);
        if (fileSource.renameTo(fileDest))
            return;
        if (true)
        {
            System.out.println("Warning, system does not support move file");
            return;
        }
        super.moveThisFile(fileSource, fileDestDir, strDestName);
        if (strNewDir == null)
            return;   // Moving to a different dir = move all.
        fileSource.delete();    // Moving to the same dir (into the new directory) means delete to old file at the root
    }
694111
function move(oldPath, newPath) {
  if (toDel[oldPath] || !fileExists(oldPath)) {
    log('Error: no file to move: ', 'red', oldPath);
    throw new Error('No file to move');
  }

  if (fileExists(newPath)) {
    log('Error: target file already exists: ', 'red', newPath);
    throw new Error('Target file already exists');
  }
  if (fileLines[oldPath]) {
    fileLines[newPath] = fileLines[oldPath];
    delete fileLines[oldPath];
  }

  // if (asts[oldPath]) {
  //   asts[newPath] = asts[oldPath];
  //   delete asts[oldPath];
  // }

  if (toSave[oldPath]) {
    toSave[newPath] = true;
    delete toSave[oldPath];
  }

  if (toDel[oldPath]) {
    delete toDel[oldPath];
  }
  // if the file has already been moved
  oldPath = _.findKey(mvs, s => s === oldPath) || oldPath;
  mvs[oldPath] = newPath;
}
887903
function doInstall(settings, destination) {
  // Create application directories if they don't exist.
  var folders = [
    destination,
    path.join(destination, '/public'),
    path.join(destination, '/extensions')
  ];
  folders.forEach(function(folder) {
    if (!fs.existsSync(folder)) {
      fs.mkdirSync(folder);
    }
  });

  // Create settings.json.
  fs.writeFileSync(path.join(destination, 'settings.json'), JSON.stringify(settings, null, '  '), {flag: 'w'});
}
490633
def fs_move(from, to)
      FileUtils.mv(File.join(self.git_dir, from), File.join(self.git_dir, to))
    end
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))
1054784
def movefile(source_path, dest_path, make_parents=False, backup_suffix=None):
  
  if make_parents:
    make_parent_dirs(dest_path)
  move_to_backup(dest_path, backup_suffix=backup_suffix)
  shutil.move(source_path, dest_path)
1295816
private void rollOverFiles() {

        Context context = appContextRef.get();

        if (context != null) {

            File dir = context.getFilesDir();

            File mainFile = new File(dir, name(1));

            if (mainFile.exists()) {

                float fileSize = mainFile.length();
                fileSize = fileSize / 1024.0f; //In kilobytes

                if (fileSize > fileSizeLimitKb) {

                    File file;
                    File target;

                    file = new File(dir, name(maxFiles));
                    if (file.exists()) {
                        file.delete();
                    }

                    for (int i = maxFiles - 1; i > 0; i--) {
                        file = new File(dir, name(i));
                        if (file.exists()) {
                            target = new File(dir, name(i + 1));
                            file.renameTo(target);
                        }
                    }
                }
            }
        }
    }
1151324
function() {
        var distDir = this.readConfig('distDir');
        var packedDirName = this.readConfig('packedDirName');
        var archivePath = this.readConfig('archivePath');

        if (packedDirName) {
          packedDirName = path.join(archivePath, packedDirName);
          this.log('moving ' + distDir + ' to ' + packedDirName);

          this.distDir = packedDirName;
          return move(distDir, packedDirName);
        }

        return RSVP.resolve();
      }
948978
def do_mv(self, subcmd, opts, message, folder):
        
        client = MdClient(self.maildir, filesystem=self.filesystem)
        client.move(message, folder)
890651
def move(self, path_list, dest, **kwargs):
        

        def __path(path):
            if path.endswith('/'):
                return path.split('/')[-2]
            else:
                return os.path.basename(path)

        params = {
            'opera': 'move'
        }
        data = {
            'filelist': json.dumps([{
                                        "path": path,
                                        "dest": dest,
                                        "newname": __path(path)} for path in path_list]),
        }
        url = 'http://{0}/api/filemanager'.format(BAIDUPAN_SERVER)
        return self._request('filemanager', 'move', url=url, data=data, extra_params=params, **kwargs)
116653
function move(fs, a, b, method, cb) {
    var parentA = path.dirname(a);
    var parentB = path.dirname(b);
    var nameA = path.basename(a);
    var nameB = path.basename(b)

    fs.metadata(a)
    .then(function(metadata) {
        return this.metadata(b)
            .then(function(metadata) {
                throw fs.error('EEXIST', 'Cannot move because target path already exist: ' + b);
            }, function(err) {
                if (err.code === 'ENOENT') {
                    return this.mkdir(parentB);
                } else {
                    throw err;
                }
            });
    })
    .then(function() {
        return this._promise(method, a, b);
    })
    .done(function() {
        cb();
    }, function(err) {
        cb(err);
    });
}
111629
def expand_folder(files):
    """"""
    expfiles = []
    for file in files:
        if os.path.isdir(file):
            for dirpath, dirnames, filenames in os.walk(file):
                for filename in filenames:
                    expfiles.append(os.path.join(dirpath, filename))
        else:
            expfiles.append(file)

    for path in expfiles:
        if not os.path.exists(path):
            sys.stderr.write('%s: No such file or directory\n' % path)

    return expfiles
1022416
function mkdirs(folderPath, mode) {
  var folders = [];
  var tmpPath = path.normalize(folderPath);
  var exists = fs.existsSync(tmpPath);
  while (!exists) {
    folders.push(tmpPath);
    tmpPath = path.join(tmpPath, '..');
    exists = fs.existsSync(tmpPath);
  }

  for (var i = folders.length - 1; i >= 0; i--) {
    fs.mkdirSync(folders[i], mode);
  }
}
786070
static void move(File src, File dest) throws IOException {
        try {
            Files.move(src.toPath(), dest.toPath());
        } catch (IOException x) {
            throw x;
        } catch (Exception x) {
            throw new IOException(x);
        }
    }
605279
def mkdir_and_cd(dirname):
    """"""
    if not os.path.exists(dirname):
        os.makedirs(dirname)
        os.chdir(dirname)
    else:
        os.chdir(dirname)