Windows批处理命令可移动目录中的所有文件夹(带例外) [英] Windows batch command to move all folders in a directory with exceptions

查看:104
本文介绍了Windows批处理命令可移动目录中的所有文件夹(带例外)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个Windows Batch文件,该文件允许我将给定源目录中的所有目录移动到该源目录中存在的目标目录中.

I am trying to write a Windows Batch file that will allow me to move all directories within a given source directory into a target directory that exists within that source directory.

很显然,我的move命令只需要应用于目录,并且还不处理目标目录.

Obviously my move command with need to only apply to directories and also exclude the target directory from being processed.

使用Windows批处理命令可以做到这一点吗?

Is this possible with a Windows batch command?

推荐答案

Robocopy (存在于Windows的最新版本或可以从 WRK 下载)可以做到这一点,只需使用/xd开关即可排除副本中的目标目录;

Robocopy (present in recent versions of windows or downloadable from the WRK) can do this, just use the /xd switch to exclude the target directory from the copy;

robocopy c:\source\ c:\source\target\ *.* /E /XD c:\source\target\ /move

这篇关于Windows批处理命令可移动目录中的所有文件夹(带例外)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆