Move path list async optional.

@param pathList           the path list
@param destinationDirPath the destination dir path
@param options            the options
@return the optional
422542
public static Optional<JMProgressiveManager<Path, Path>> movePathListAsync(
            List<Path> pathList, Path destinationDirPath,
            CopyOption... options) {
        return operateBulk(pathList, destinationDirPath,
                sourcePath -> JMPath.isDirectory(sourcePath)
                        ? moveDir(sourcePath, destinationDirPath, options)
                        : Optional.ofNullable(
                        move(sourcePath, destinationDirPath, options)));
    }
784314
public static List<Path> getSubPathList(Path startDirectoryPath,
			Predicate<Path> filter) {
		return getSubPathList(startDirectoryPath, Integer.MAX_VALUE, filter);
	}
1111381
public static <T> Optional<Optional<T>> getOptional(final List list, final Class<T> clazz, final Integer... path) {
        return get(list, Optional.class, path).map(opt -> (Optional<T>) opt);
    }
895966
@Override
    public T move(ArchivePath source, ArchivePath target) throws IllegalArgumentException, IllegalArchivePathException {
        Validate.notNull(source, "The source path was not specified");
        Validate.notNull(target, "The target path was not specified");

        final Node nodeToMove = get(source);
        if (null == nodeToMove) {
           throw new IllegalArchivePathException(source.get() + " doesn't specify any node in the archive to move");
        }
        final Asset asset = nodeToMove.getAsset();
        // Directory?
        if (asset == null) {
            this.addAsDirectory(target);
        } else {
            add(asset, target);
        }

        // move children
        final Set<Node> nodeToMoveChildren = nodeToMove.getChildren();
        for (final Node child : nodeToMoveChildren) {
            final String childName = child.getPath().get().replaceFirst(child.getPath().getParent().get(), "");
            final ArchivePath childTargetPath = ArchivePaths.create(target, childName);
            move(child.getPath(), childTargetPath);
        }

        delete(source);

        return covariantReturn();
    }
1281833
def remove_dir(self, destination_path):
        

        wd = self.conn.pwd()

        try:
            names = self.conn.nlst(destination_path)
        except ftplib.all_errors as e:
            # some FTP servers complain when you try and list non-existent paths
            logger.debug('FtpRmTree: Could not remove {0}: {1}'.format(
                destination_path, e))
            return

        for name in names:
            if os.path.split(name)[1] in ('.', '..'):
                continue

            try:
                self.conn.cwd(name)  # if we can cwd to it, it's a folder
                self.conn.cwd(wd)  # don't try a nuke a folder we're in
                self.remove_dir(name)
            except ftplib.all_errors:
                self.conn.delete(name)

        try:
            self.conn.rmd(destination_path)
        except ftplib.all_errors as e:
            logger.debug('remove_dir: Could not remove {0}: {1}'.format(
                destination_path, e))
208513
public ListenableFuture<Boolean> moveToTrashFuture(final Path path) {
    return this.executor.submit(new Callable<Boolean>() {
      @Override
      public Boolean call() throws IOException {
        return AsyncTrash.this.innerTrash.moveToTrash(path);
      }
    });
  }
787246
public void setPath(List<? extends S> path, Direction1D direction) {
		this.path = path == null || path.isEmpty() ? null : new ArrayList<>(path);
		this.firstSegmentDirection = detectFirstSegmentDirection(direction);
	}
433123
public static <T> Optional<T> get(final List list, final Class<T> clazz, final Integer... path) {
        if (path == null || path.length == 0) {
            throw new IllegalArgumentException(PATH_MUST_BE_SPECIFIED);
        }
        if (path.length == 1) {
            return Optional.ofNullable((T) list.get(path[0]));
        }
        final Integer[] pathToLastNode = Arrays.copyOfRange(path, 0, path.length - 1);
        final Integer lastKey = path[path.length - 1];
        List intermediateList = list;
        for (Integer index : pathToLastNode) {
            final Object node = intermediateList.get(index);
            if (node != null) {
                final Optional<List> nodeListOption = ClassApi.cast(node, List.class);
                if (nodeListOption.isPresent()) {
                    intermediateList = nodeListOption.get();
                } else {
                    throw new IllegalAccessError("Node with key '" + index + "' is not a list!");
                }
            } else {
                return Optional.empty();
            }
        }
        return Optional.ofNullable((T) intermediateList.get(lastKey));
    }
1050920
def move(srcpath, dstpath, overwrite=True):
    """"""
    # TODO: (JRR@201612230924) Consider adding smarter checks to prevent files ending up with directory names; e.g. if dstpath directory does not exist.
    if not op.exists(srcpath):
        return False
    if srcpath == dstpath:
        return True
    if op.isfile(srcpath) and op.isdir(dstpath):
        verfunc = op.isfile
        verpath = op.join(dstpath, op.basename(srcpath))
    elif op.isfile(srcpath):
        verfunc = op.isfile
        verpath = dstpath
        makedirs(dstpath)
    elif op.isdir(srcpath) and op.isdir(dstpath):
        verfunc = op.isdir
        verpath = op.join(dstpath, op.basename(srcpath))
    elif op.isdir(srcpath):
        verfunc = op.isdir
        verpath = dstpath
    else:
        return False
    if op.isfile(verpath):
        if not overwrite:
            return False
        else:
            # On Windows, filename case is ignored so the following check will
            # prevent unintentionally deleting the srcpath before moving.
            if "nt" == os.name and srcpath.lower() == dstpath.lower():
                pass
            elif not delete(verpath):
                return False
    try:
        shutil.move(srcpath, dstpath)
    except:
        return False
    return verfunc(verpath)
732394
public static JMProgressiveManager<Path, Boolean>
    deleteAllAsync(List<Path> pathList) {
        debug(log, "deleteAllAsync", pathList);
        return new JMProgressiveManager<>(pathList,
                targetPath -> Optional.of(deleteAll(targetPath)));
    }
566145
public ListenableFuture<Boolean> moveToTrashAsUserFuture(final Path path, final String user) {
    return this.executor.submit(new Callable<Boolean>() {
      @Override
      public Boolean call() throws IOException {
        return AsyncTrash.this.innerTrash.moveToTrashAsUser(path, user);
      }
    });
  }
1281244
def move(self, old_path, new_path, raise_if_exists=False):
        
        if raise_if_exists and os.path.exists(new_path):
            raise FileAlreadyExists('Destination exists: %s' % new_path)
        d = os.path.dirname(new_path)
        if d and not os.path.exists(d):
            self.mkdir(d)
        try:
            os.rename(old_path, new_path)
        except OSError as err:
            if err.errno == errno.EXDEV:
                new_path_tmp = '%s-%09d' % (new_path, random.randint(0, 999999999))
                shutil.copy(old_path, new_path_tmp)
                os.rename(new_path_tmp, new_path)
                os.remove(old_path)
            else:
                raise err
796545
public static Action moveFileToEmptyPath(final String srcPath, final String destPath) {
        if (srcPath == null)
            throw new IllegalArgumentException("The srcPath variable cannot be null");
        if (destPath == null)
            throw new IllegalArgumentException("The destPath variable cannot be null");

        return new Action(
            // Perform:
            new ActionBlock() {
                @Override
                public void execute() throws ActionException {
                    File destFile = new File(destPath);
                    if (destFile.exists())
                        throw new ActionException("Cannot move file. " +
                                "The Destination file " + destPath + " already exists.");
                    boolean success = new File(srcPath).renameTo(destFile);
                    if (!success)
                        throw new ActionException("Cannot move file " + srcPath +
                                " to " + destPath);
                }
            },
            // Backout:
            new ActionBlock() {
                @Override
                public void execute() throws ActionException {
                    boolean success = new File(destPath).renameTo(new File(srcPath));
                    if (!success)
                        throw new ActionException("Cannot move file " + destPath +
                                " to " + srcPath);
                }
            },
            // Cleanup:
            null);
    }
870447
def move(path,destination)
      path = @uri.merge(path).path
      destination = @uri.merge(destination).to_s
      headers = {'Destination' => destination}
      res = @handler.request(:move, path, nil, headers.merge(@headers))
      res.body
    end
241620
public static String toSimpleTraversrPath(Object[] paths) {
        StringBuilder pathBuilder = new StringBuilder();
        for(int i=0; i<paths.length; i++) {
            Object path = paths[i];
            if(path instanceof Integer) {
                pathBuilder.append("[").append(((Integer) path).intValue()).append("]");
            }
            else if(path instanceof String) {
                pathBuilder.append(path.toString());
            }
            else{
                throw new UnsupportedOperationException("Only Strings and Integers are supported as path element");
            }
            if(!(i+1 == paths.length)) {
                pathBuilder.append(".");
            }
        }
        return pathBuilder.toString();
    }
373953
protected function moveSettingsPaths($sourcePath, $destinationPath)
    {
        $this->processConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS,
            function (array &$configuration) use ($sourcePath, $destinationPath) {
                $sourceConfigurationValue = Arrays::getValueByPath($configuration, $sourcePath);
                $destinationConfigurationValue = Arrays::getValueByPath($configuration, $destinationPath);

                if ($sourceConfigurationValue !== null) {
                    // source exists, so we need to move source to destination.

                    if ($destinationConfigurationValue !== null) {
                        // target exists as well; we need to MERGE source and target.
                        $destinationConfigurationValue = Arrays::arrayMergeRecursiveOverrule($sourceConfigurationValue, $destinationConfigurationValue);
                    } else {
                        // target does NOT exist; we directly set target = source
                        $destinationConfigurationValue = $sourceConfigurationValue;
                    }

                    // set the config on the new path
                    $configuration = Arrays::setValueByPath($configuration, $destinationPath, $destinationConfigurationValue);

                    // Unset the old configuration
                    $configuration = Arrays::unsetValueByPath($configuration, $sourcePath);

                    // remove empty keys before our removed key (if it exists)
                    $sourcePathExploded = explode('.', $sourcePath);
                    for ($length = count($sourcePathExploded) - 1; $length > 0; $length--) {
                        $temporaryPath = array_slice($sourcePathExploded, 0, $length);
                        $valueAtPath = Arrays::getValueByPath($configuration, $temporaryPath);
                        if (empty($valueAtPath)) {
                            $configuration = Arrays::unsetValueByPath($configuration, $temporaryPath);
                        } else {
                            break;
                        }

                    }
                }
            },
            true
        );
    }
54647
public static String movePath( final String file,
                                   final String target ) {
        final String name = new File(file).getName();
        return target.endsWith("/") ? target + name : target + '/' + name;
    }