2012-11-05 70 views
2

我有一個directoy結構從而批次每個到每一個具體的文件從目錄複製到是自己的子目錄

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' 

但我怎麼辦這與一批

回答

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 
) 
) 
+0

非常感謝,正是我想要的 – Sonny123

相關問題