這是本文件的舊版!
批次將 URL 編碼檔名解碼
像 DokuWiki 預設會將頁面文件檔(.txt)檔名的 UTF-8 字元,用 URL 格式編碼,也就是說非 ASCII 字元都會編為「%30%AB……」這樣的天書。如果在 DokuWiki 的管理介面中想把檔名編碼格式改為 utf8
還不行,會導致 DokuWiki 抓不到現有的文件檔,會全部亂套。
所以,如果想讓 DokuWiki 改用 UTF-8 檔名的話,還得先把現有文件檔的 URL encoding 全部解碼才行。但哪裡有批次解碼的工具?
→ 找了一下找到這裡推薦 renameutils。renameutils home 這裡有官方教學。
但 renameutils 似乎原本寫給 Linux 作業系統用,那 macOS 上怎辦?
→ 幸好 Install renameutils on Mac OSX – Mac App Store 這邊有安裝教學。
→ 裝好 renameutils 後,確實可以用 deurlname 這個指令批次解碼。但,它無法處理子目錄裡的檔案啊!!!
這邊有一個要 25 歐元的 Windows 小軟體可以處理子目錄下的檔案:URL Decode Filenames - Convert Filenames - Overview
或像這篇說的 shell script 來在逐個子資料夾執行指令,有沒有搞頭?shell script - cd into all directories, execute command on files in that directory, and return to previous current directory - Unix & Linux Stack Exchange
討論區