本帖最后由 aloha20200628 于 2024-12-21 21:15 编辑
回复 1# 思想之翼
先给出用 bat+sed 可直达6种结果的一行流代码...
结果-1- @echo off &cd /d "d:\data1" &for /f "delims=" %%a in ('dir /b/o-s *.txt^|sed -n "1,50p" ') do copy /y "%%a" "d:\data2\"
复制代码 结果-2- @echo off &cd /d "d:\data1" &for /f "delims=" %%a in ('dir /b/o-s *.txt^|sed -n "51,$p" ') do del /q "%%a"
复制代码 结果-3- @echo off &cd /d "d:\data1" &for /f "delims=" %%a in ('dir /b/os *.txt^|sed -n "1,50p" ') do copy /y "%%a" "d:\data2\"
复制代码 结果-4- @echo off &cd /d "d:\data1" &for /f "delims=" %%a in ('dir /b/os *.txt^|sed -n "51,$p" ') do del /q "%%a"
复制代码 结果-5- @echo off &cd /d "d:\data1" &for /f "delims=" %%a in ('dir /b/os/-c *.txt') do if "%%~za" equ "1024" (copy /y "%%a" "d:\data2\")
复制代码 结果-6- @echo off &cd /d "d:\data1" &for /f "delims=" %%a in ('dir /b/o-s/-c *.txt') do if "%%~za" neq "1024" (del /q "%%a")
复制代码
|