How to Bulk Rename File Extensions to Lowercase Using PowerShell and CMD

If you have files with the uppercase ‘.PDF’ extension scattered in various subfolders and need to rename them to lowercase ‘.pdf’, you can easily do this using PowerShell and Command Prompt on Windows.

For example:

  • file1.PDF
  • Directory1\File2.PDF
  • Directory2\File3.PDF

Will change to:

  • file1.opdf
  • Directory1\File2.pdf
  • Directory2\File3.pdf

Using Command Prompt:

  1. Press Windows key + R to open the Run dialog box.
  2. Type cmd and press Enter or click OK to launch Command Prompt.
  3. Browse to the root directory you want to update files in.
  4. Type in and execute the following command:
    for /r %f in (*.PDF) do (ren "%f" "%~nf.TMP" && ren "%~dpnf.TMP" "%~nf.pdf")

    This command finds all files with the ‘.PDF’ extension in the current directory and subdirectories, and renames them to lowercase ‘.pdf’.

Using PowerShell:

  1. Press Windows key + X and select “Windows PowerShell” from the menu. 
  2. Browse to the root directory you want to update files in.
  3. Type in and execute the following command:
    Get-ChildItem -Path . -Recurse -Filter *.PDF | Rename-Item -newname { $_.name -replace '.PDF','.pdf' }
    

     

By following these steps, you should have successfully renamed all file extensions from uppercase ‘.PDF’ to lowercase ‘.pdf’.

Note: Before running these commands, make sure to backup your files. Renaming files is irreversible. The changes might not be visible in Windows File Explorer, but are significant for case-sensitive systems.