2

因此我有一个目录结构

C:folder\
        \davis\Myfiles\saved
        \brown\Myfiles\saved
        \smith\Myfiles\saved
        \jones\Myfiles\saved

我想要达到的是这个

for each directory called 'Myfiles'
   IF NOT Exists 'Myfiles\*doc.rtf'
      copy files caled 'Myfiles\*doc.txt' to the subdirectory 'Myfiles\saved'
      move files called 'Myfiles\*doc.txt' to 'somewhereElse'

但是我如何用一批来做到这一点

4

1 回答 1

1

阅读HELP FOR并尝试此代码,它可能会帮助您入门...

for /r /d %%a in (*) do (
 if /i %%~na==myfiles (
    pushd %%a
    for %%b in (*doc.txt) do (
     if not exist %%~nb.rtf (
       echo copy %%b saved
       echo move %%b \somehwereelse
     )
    )
    popd
  )
)
于 2012-11-05T20:00:22.937 回答