#Use PowerShell to Convert All Files in a Folder to Lowercase Instead of Uppercase
#Here’s a PowerShell script to convert all filenames in a folder to lowercase:
#Just the code
Get-ChildItem -Path "C:\test" -Recurse | ForEach-Object { $newName = $_.Name.ToLower() # or .ToUpper() for uppercase if ($_.Name -cne $newName) { Rename-Item -LiteralPath $_.FullName -NewName $newName -Force } }
#Longer Story
#When attempting to convert filenames to lowercase from a CD-ROM using PowerRename, I encountered challenges primarily due to file system limitations, specifically with ExFAT partitions. The led me to develop a PowerShell script that effectively renames files and discovered that the script only works when files were first copied to an NTFS partition.
#ExFAT Limitation
#ExFAT (Extended File Allocation Table) is a file system designed for flash drives and external hard drives. While it offers advantages like large file size support and cross-platform compatibility, it has some limitations when it comes to file operations:
- Case Sensitivity: ExFAT is case-preserving but case-insensitive. This means it maintains the case of filenames as they were created, but doesn’t distinguish between uppercase and lowercase when accessing files.
- Rename Operations: Some tools and scripts may have difficulty renaming files on exFAT partitions due to how the file system handles these operations
- Permissions: ExFAT doesn’t support the same level of file permissions as NTFS, which can affect certain operations
#PowerRename and ExFAT
#PowerRename, a PowerToy utility, may show that it’s working on ExFAT but fails to actually rename the files.
#NTFS Compatibility
NTFS (New Technology File System) is more robust and supports a wider range of file operations.