2011-11-14 3 views
3

나는 공백 밑줄을 교체하고 또한 PowerShell을 사용하여에서 constant_을 제거 할 수있는 방법이 형식대용량 파일 이름 바꾸기 - PowerShell을

constant_blah_blah_blah.png 

의 폴더에 많은 파일이?

미리 감사드립니다.

+0

미안하지만 난 아무것도 시도하지 않았습니다. 나는 PowerShell이 ​​어떻게 작동하는지 전혀 모른다. – Tsarl

+0

여기, Google 검색 및/또는 MSDN의 Powershell 설명서를 살펴 보는 것이 좋습니다. –

답변

6

Get-childItem constant* | % {rename-item $_.name ($_.name -replace '_',' ')} 
Get-childItem constant* | % {rename-item $_.name ($_.name -replace 'constant ','')} 
+0

이것은 두 개의 이름을 변경하지만 필요하지는 않습니다 (내 답변 참조). – Joey

5
# gather all files that match the criteria 
Get-ChildItem constant_* | 
    ForEach-Object { 
     # remove the "constant_" from the beginning and replace _ by space. 
     Rename-Item $_ ($_.Name -replace '^constant_' -replace '_', ' ') 
    } 

이하를 시도 할 수 있습니다 :

ls constant_* | %{rni $_ ($_.Name -replace '^constant_' -replace '_', ' ')} 
+0

+1 및 필터링 ls/% 확장. –