代码之家  ›  专栏  ›  技术社区  ›  vuaccaesse

使用条件和基本文件TXT读取批量解压缩文件

  •  1
  • vuaccaesse  · 技术社区  · 7 年前

    C:\测试

    现在,我只想根据包含LSP或LSG或LSP021或LSG021的名称来详细说明这个文件的一个子集

     [*LSP*.*,*LSG*.*,*LSP021*.*,*LSP021*.*]
    

    当我找到匹配的文件时,我必须

    • 解压它
    • 最后将其移动到文件夹中。
    • (擦除每个温度)

    我在哪里:

      rem loop through all the zips
    for  /R "C:\Test\" %%c in (*.zip) do (`enter code here`
        rem make a temporary folder with the same name as zip to house the zip content
        if not exist %%~nc md %%~nc
        rem extract zip content into the temporary folder
        7za e -o"%%~nc" %%c
        if exist "%%~nc" (
            rem jump into the temporary folder
            pushd "%%~nc"
            if exist *.* (
                rem loop through all the files found in the temporary folder and prefix it with the zip's name
                for %%i in (*.*) do (
                    ren "%%i" "%%~nc.%%i"
                )
             )
            rem jump out of the temporary folder
            popd
        )
    
    0 回复  |  直到 7 年前