Hi, I'm Ravish, an independent Windows advisor, and I'm here to assist you today.
To efficiently rename all files while making the desired changes, you can use a single PowerShell script. Below is a streamlined and flexible solution:
# Directory where your files are located
$directory = "F:\FILES"
# Get all files with the '.prn' extension
Get-ChildItem -Path $directory -Filter *.prn | ForEach-Object {
$newName = $_.Name.ToUpper() # Convert the entire name to uppercase
$newName = $newName -replace '!', '_' # Replace '!' with '_'
$newName = [System.IO.Path]::ChangeExtension($newName, ".txt") # Change extension to .txt
Rename-Item -Path $_.FullName -NewName $newName
}
Instructions
Replace "F:\FILES" with your target folder path.
Save the script in a .ps1 file or run it directly in PowerShell.
Ensure your PowerShell execution policy allows script running. If not, use:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
This approach will handle multiple variations and apply all requested changes efficiently.
Hope it helps