Windows大寫檔名批次轉換成小寫(filename convert to lowercase)

林罡北
4 min readNov 25, 2017

--

由於android有限制放進app中的檔案的檔案名稱不能夠有小寫
所以需要先把一堆有大寫英文字母的檔案轉成小寫
因為不想下載軟體…又懶得寫程式
只好上網找找別人寫好的囉哈哈

結果滿多人都用CMD去做這件事情
令我滿意外的,我也不是全部都看得懂,但是實際上可以用就是了

執行環境的部分
因為我是在Windows底下run的,所以MacOS和Linux我就不確定了

總之以下這幾個方式都可以成功把檔案名稱中的大寫轉成小寫
執行完畢之後,如果資料夾有開著的話要按一下F5重新整理之後才會看到結果

Use Batch file

一樣,在你要處理的檔案的資料夾目錄下,執行Batch file
該指令只會對「執行指令的資料夾目錄」的檔案進行處理

for /F %%a in ('dir /L /B') do rename %%a %%a

Use Commad Line Interface

在你要處理的檔案的資料夾目錄下,執行下面這行指令
該指令只會對「執行指令的資料夾目錄」的檔案進行處理

for /F %a in ('dir /L /B') do ren %a %a

or

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")

這個指令的解說

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")

Here is the break-down in case someone wants to modify/improve :

  • for /f - For every line
  • "Tokens=*" - Process each item in every line.
  • %f in (...) - %f is your variable name for every item.
  • dir - lists every file and subdirectory in a directory.
  • /l - (parameter for dir) Uses lowercase.
  • /b - (parameter for dir) Uses bare format, only the file/directory names, no size, no headers.
  • /a-d - (parameter for dir) Do not list directories. (a stands for attribute, - stands for notand d stands for directory).
  • rename "%f" "%f"- rename the file with its own name, which is actually lowercased by the dir command and /l combination.

Use GUI Tool

spacetornado Renamer is a Windows program that renames mass amounts of files in batches. You can search and replace text, remove a certain number of characters, change the case to lower, upper or First Letter Capital, and add text to the beginning or end (append/prepend) of every filename

spacetornado Renamer是個相當好用的檔案命名工具,跟一般檔案名稱修改工具不太一樣的是,他可以讓我們修改、刪除檔名中的指定文字,或者指定移除多少字元(不特定文字)、更換英文字的大小寫或在檔案名稱前、後新增你指定的中英文或數字。

每個重命名的任務都可設定不同的執行順序,讓我們可以完全依照自己的需求將檔案名成改成你要的樣子。

--

--

林罡北
林罡北

Written by 林罡北

Founder of TroublesLab, F2E & Web/App Developer

No responses yet