|
論壇說明 |
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
|
主題工具 | 顯示模式 |
2004-11-13, 01:12 PM | #1 |
榮譽會員
|
管理下載電影目錄的指令碼
經常在1台不關機的電腦上下載電影,一次性通常下載很多,等都下載完畢後開始解壓縮文件,感覺很麻煩,儘管使用 TotalCmd 工具,所以編寫了下面的指令碼,使用 JPSoft 的 4NT 執行。
它會遍歷下載目錄下面的所有子目錄,然後解壓縮其中的 RAR 文件,如果一切正常,則移除源文件,如果電影是多張 CD 的,則會自動解壓縮 CD 子目錄下的 RAR 文件。全部工作由日誌可以查詢。 程式碼: : Movies donwload direcotry manager helper : Created by Che Ming 2004 setlocal alias rar="c:\program files\WinRAR\rar.exe" set rootdir=%_CWD set logfilename=%rootdir%\mop.log set filetoprocess=__filetoprocess.$$$ for /a:d /h %subdir in (*.*) do ( pushd "%rootdir%\%subdir" gosub WriteLog "Starting in [%subdir%] ..." iff %@files["CD?",d] GE 1 then for %i in (1 2 3 4 5) do ( iff exist "CD%i%" then pushd "%rootdir%\%subdir%\CD%i%" gosub WriteLog "Starting in [%subdir%\CD%i%] ..." gosub ExtractArchives popd endiff ) else gosub ExtractArchives endiff popd ) endlocal quit :WriteLog [msg] iff exist %logfilename% then echo %_DATE %_TIME : %msg% >> %logfilename% else echo %_DATE %_TIME : %msg% > %logfilename% endiff return 0 :ExtractArchives set files_to_operation=%@FILES[*.R??] gosub WriteLog "Files to Operaion: %files_to_operation%" iff %files_to_operation% GE 1 then if exist __filetoprocess.$$$ then *del "%filetoprocess%" /q/y *dir /b *.r?? > "%filetoprocess%" rar t *.rar iff %? NE 0 then gosub WriteLog "Find error when testing archives..." else rar x *.rar iff %? NE 0 then gosub WriteLog "Find errors when extracting archives..." else for %filename in (@"%filetoprocess%") *del /q/y %filename endiff endiff *del /q/y "%filetoprocess%" else gosub WriteLog "Files number is not enough!" endiff return |
送花文章: 3,
|