Wednesday, August 6, 2014

Rename all files in a directory using Powershell

#All the files in the directory are uppercase i.e "TEST.TXT"
#We set the first letter to lowercase for this example
gci -Path D:\temp\ -File -Filter "*.txt" | foreach{$_| `
Rename-Item -NewName $($_.Name.substring(0,1).Tolower() + $_.Name.Substring(1))} -ErrorAction SilentlyContinue
 

No comments:

Post a Comment