bat程式碼如下(路徑已經是linux的了)
@echo off
setlocal enabledelayedexpansion
set "SrcDir=/volume1/homes/aa/111"
cd /d "%SrcDir%"
for /f "tokens=1-3 delims=" %%a in ("dir /a-d/b") do (
set "write_date=%%~ta"
set "write_date=!write_date:/=!"
set "write_date=!write_date:~0,4!!write_date:~5,2!"
if not exist !write_date! md "!write_date!"
move /y "%%a" "!write_date!"
)
bat指令碼和.sh指令碼很多地方相似,把linux不支援的改成支援的,改個名或者不改名,都可以直接在linux下執行的,給個可執行許可權就行了。
bat程式碼如下(路徑已經是linux的了)
@echo off
setlocal enabledelayedexpansion
set "SrcDir=/volume1/homes/aa/111"
cd /d "%SrcDir%"
for /f "tokens=1-3 delims=" %%a in ("dir /a-d/b") do (
set "write_date=%%~ta"
set "write_date=!write_date:/=!"
set "write_date=!write_date:~0,4!!write_date:~5,2!"
if not exist !write_date! md "!write_date!"
move /y "%%a" "!write_date!"
)