Sa mga gustong matoto pagrename ng mga files sa loog ng current folder heto ang Powershell command to the rescue.
Explanation:
--------------------------------------------
- launches a PowerShell session to run the quoted command.
- is short for -Command.
- returns all the files in the current directory. It is an alias for Get-ChildItem.
- makes a pipeline to process each file. % is an alias for Foreach-Object.
- is the name of the current file in the pipeline.
- uses the -replace operator to create the new file name. Each occurrence of the "old-string" is replaced with the "new-string".
- changes the name of each file. The first parameter (called -Path) identifies the file. The second parameter (called -NewName) specifies the new name. rni is an alias for Rename-Item.
Code:
powershell -C "gci | % {rni $_.Name ($_.Name -replace 'old-string', 'new-string')}"
Explanation:
--------------------------------------------
Code:
powershell -C "..."
Code:
-C
Code:
gci
Code:
| % {...}
Code:
$_.Name
Code:
($_.Name -replace 'old-string', 'new-string')
Code:
rni