Board logo

标题: [文件操作] 急需一个批处理,移动不同目录中的相同文件,到上一层. [打印本页]

作者: t85012525    时间: 2014-8-2 12:51     标题: 急需一个批处理,移动不同目录中的相同文件,到上一层.

windows下,移动不同目录中的相同文件,到上一层。
目录结构:
E:\wwwroot\CANGXI\HttpDocs\html\index.html
E:\wwwroot\CHONGYANG\HttpDocs\html\index.html
E:\wwwroot\FAKU\HttpDocs\html\index.html
移动index.html到HttpDocs目录下
作者: DAIC    时间: 2014-8-2 16:16

  1. @echo off
  2. for /f "delims=" %%i in ('dir /b /s "E:\wwwroot" ^| findstr "\index.html"') do (
  3.     move "%%i" "%%i\..\..\.."
  4. )
复制代码

作者: t85012525    时间: 2014-8-2 18:26

谢谢 ,十分感谢~
作者: t85012525    时间: 2014-8-2 18:32

@DAIC 试了一下,多以了一层目录,去掉了一个\..后,好了,十分感谢!!
作者: CYUYAN09    时间: 2014-12-12 21:22

回复 2# DAIC


    您好,findstr "*\index.html"'这个这样写为什么不行呢?用通配符怎么能匹配不上呢?您能告诉我一下吗?
作者: DAIC    时间: 2014-12-13 17:37

回复 5# CYUYAN09


在星号前面加个点试试
  1. findstr ".*\index.html"
复制代码

作者: CYUYAN09    时间: 2014-12-14 09:50

回复 6# DAIC


    哦哦明白了。谢谢




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2