返回列表 发帖

[文本处理] 批处理整理桌面文件

按修改时间整理,贴在这里备份,不太实用,不了解代码的慎用。
@echo off&chcp 936
for /f "delims=" %%a in ('dir/a/b')do if /i not "%%~xa"==".bat" (
    set "nxa=%%~nxa"
    setlocal enabledelayedexpansion
    if "!nxa:~4,1!!nxa:~7,1!" neq "--" endlocal&(
        if not "%%~nxa"=="%~nx0" (
            if not "%%~ta" == "%date:~0,10%" (
                set dt=%%~ta
                set "File=%%a"
                set "fn=%%~na"
                set "fx=%%~xa"
                setlocal enabledelayedexpansion
                    set dt=!dt:~0,10!
                    if not exist !dt! md !dt!
                    if exist "!dt!\!file!" ren "!file!" "!fn!_!time:~-5!"
                    move  "!file!" !dt!\||echo error: !file!
                    title !dt!\ !file!
                endlocal
            )   
        )
    )else endlocal
)
pauseCOPY

不错  学些 知识

TOP

返回列表