命令行将文件夹移动到父文件夹

Windows Server 2003 / XP

由于move.exe不是在Windows Server 2003中插入。有没有办法(在命令行中):

move C:\path\to\folder C:\path\folder 

由于该文件夹包含很多文件,并且尺寸很大。 我不想复制和删除原始文件夹。

我知道这应该通过一个相当简单的方法来完成,因为如果你在资源pipe理器中剪切和粘贴,这是瞬间的。

移动是与2003年一起来的。这是你正在做什么? (粘贴到命令行)

 mkdir path mkdir path\to mkdir path\to\folder mkdir path\to\folder\subfolder echo hi >path\to\folder\subfolder\file.txt echo hi >path\to\folder\file.txt cd path\to\ move folder .. cd .. dir /s /b 

最后的目录应该显示如下内容:

 D:\path\folder D:\path\to D:\path\folder\file.txt D:\path\folder\subfolder D:\path\folder\subfolder\file.txt 

像ROBOCOPY可能会为你做的伎俩。

“Robocopy”或“Robust File Copy”是命令行目录复制命令,它已经作为从Windows NT 4.0开始的Windows资源工具包的一部分提供,并作为Windows Vista,Windows 7的标准function引入Windows Server 2008.该命令实际上是robocopy。“

大声思考:

您可以创buildbatch file :

  • Copy文件Copy到新文件夹
  • 从旧文件夹中删除文件

Google, copy.exedel.exe ,还签出: DOS命令参考

像下面的东西( testing ):另存为Move.BAT

 @echo ON @echo Copying... copy /b "location1\file1" "\location2\" @echo Verifying... fc /b "file1" "\location2\file1"|find /i "no differences">nul @echo Validating... if not errorlevel 1 del file1 if not errorlevel 1 >>"file.log" echo file copied successfully if errorlevel 1 >>"file.log" echo an error detected in "\location2\file1" @echo Complete.