回復 sbg

可加for each ....  

via HKEPC Reader for Android
fred2088 發表於 2022-12-2 12:10


只做個sample
等樓主自己諗吓佢想點搬
自己再寫

TOP

參考 https://stackoverflow.com/questi ... l-with-batch-script

@Echo off
Pushd "主目錄A 路徑" || Exit /B 1
For /d %%P in (*) Do (
    For /d %%S in ("%%P\*") Do (
        Move "%%~fS\*" "%%~fP\" 2>&1>Nul
        RD /S /Q "%%~fS" 2>&1>Nul
    )
)
PopD

Before:
├───Record A
│   ├───2019
│   │       file A.txt
│   │
│   ├───2020
│   │       file B.txt
│   │
│   └───2021
│           file C.txt
│
├───Record B
│   ├───2019
│   │       file D.txt
│   │
│   ├───2020
│   │       file E.txt
│   │
│   └───2021
│           file F.txt
│
└───Record C
    ├───2019
    │       file G.txt
    │
    ├───2020
    │       file H.txt
    │
    └───2021
            file I.txt

After:
├───Record A
│       file A.txt
│       file B.txt
│       file C.txt
│
├───Record B
│       file D.txt
│       file E.txt
│       file F.txt
│
└───Record C
        file G.txt
        file H.txt
        file I.txt

TOP

ching好嘢
送到埋口

TOP

回覆 13# sbg


    看看他有沒有信心用, 出問題的話有排整 ...

TOP

參考

@Echo off
Pushd "主目錄A 路徑" || Exit /B 1
For /d %%P in (*) Do (
    For /d %%S in ("%%P\*" ...
SleepyPrince 發表於 2022-12-2 14:02


感謝幫忙

TOP

最好backup 左先,一間有咩事overwrite 左啲files

TOP

本帖最後由 fwood 於 2022-12-18 22:18 編輯

睇返唔太清潔樓主想點做.
但回應卻不是樓主講個樣野(我理解係),樓主都冇講過話要分返年份GROUP在一齊只係話全部FOLDER放上一層

TOP