看板 EZsoft 關於我們 聯絡資訊
假如要合併D槽裡面的txtMerge資料夾中所有txt檔 然後輸出一個allfiles.txt 步驟: 打開CMD.exe 鍵入【D:】換槽 鍵入【CD txtMerge】換到D槽下面的txtMerge資料夾 鍵入【for %I in (*.txt) do @echo ==###############==%~nxI >>allfiles.txt && type "%~nxI" >>allfiles.txt】 這樣不但 單一資料夾中所有 txt檔合併成一個txt檔 還有顯示 個別的檔名 但是我需要 單一資料夾中包含子資料夾的 txt檔合併成一個txt檔 還有顯示 個別的路徑 請問 CMD指令 還是 其他軟體 能做到嗎? 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.134.146.2 ※ 文章網址: https://www.ptt.cc/bbs/EZsoft/M.1498486774.A.DF7.html
newversion: find /path -name '*.txt' -exec echo % >> all.txt 06/26 22:51
newversion: \; -a cat "%" >> all.txt \; 06/26 22:53
newversion: 上面錯了!! 以下更正XD 06/26 22:58
newversion: find /path -name '*.txt' -exec echo "{}" \; -exec 06/26 22:59
newversion: cat "{}" \; > allfiles.txt 06/26 23:00
newversion: 以上find是GNU的find.... 不是windows的find 06/26 23:01
hijkxyzuw: 寫成 bat 檔吧 06/28 14:36
promnb: dir /s /b txtMerge\*.txt 就能得到file-list 06/28 21:29
promnb: 再利用for /f 來做; 或是直接使用for /r 來做。 06/28 21:34