1+2.bat- @echo off
- cd /d "%~dp0"
- for /f "delims=" %%i in ('dir /b /a-d *.xpl') do (
- echo --- %%i
- for /f tokens^=2^ delims^=^" %%a in ('type "%%i" ^| findstr "filename"') do (
- set "MyFile=%%a"
- setlocal enabledelayedexpansion
- set "MyFile=!MyFile:\\isilon.zf.com\ADASdata\=Z:\!"
- set "NewFolder=%%~ni"
- if not exist "!NewFolder!" (
- md "!NewFolder!"
- )
- echo xcopy /y "!MyFile!" "!NewFolder!"
- xcopy /y "!MyFile!" "!NewFolder!"
- set "FileThis=1!MyFile:~-7,3!"
- set /a FileBefore2=FileThis-2
- set /a FileBefore1=FileThis-1
- set /a FileAfter1=FileThis+1
- if !FileThis! equ 1001 (
- xcopy /y "!MyFile:~0,-8!!FileAfter1:~1!%%~xa" "!NewFolder!"
- ) else if !FileThis! equ 1002 (
- xcopy /y "!MyFile:~0,-8!!FileBefore1:~1!%%~xa" "!NewFolder!"
- xcopy /y "!MyFile:~0,-8!!FileAfter1:~1!%%~xa" "!NewFolder!"
- ) else if !FileThis! equ 1999 (
- xcopy /y "!MyFile:~0,-8!!FileBefore2:~1!%%~xa" "!NewFolder!"
- xcopy /y "!MyFile:~0,-8!!FileBefore1:~1!%%~xa" "!NewFolder!"
- ) else (
- xcopy /y "!MyFile:~0,-8!!FileBefore2:~1!%%~xa" "!NewFolder!"
- xcopy /y "!MyFile:~0,-8!!FileBefore1:~1!%%~xa" "!NewFolder!"
- xcopy /y "!MyFile:~0,-8!!FileAfter1:~1!%%~xa" "!NewFolder!"
- )
- endlocal
- )
- )
- pause
复制代码
|