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:
- Press
Windows key + R
to open the Run dialog box. - Type
cmd
and pressEnter
or clickOK
to launch Command Prompt. - Browse to the root directory you want to update files in.
- 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:
- Press
Windows key + X
and select “Windows PowerShell” from the menu. - Browse to the root directory you want to update files in.
- 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.