2014. 9. 19. 16:16
Powershell을 이용하면 원하는 파일을 쉽게 찾을 수 있다.
여기서 핵심은 -filter 매개변수와 -recurse 매개변수이다
Dir c:\windows\system32 -Recurse -Filter *.msc
(-Recurse: 하위 폴더까지 검색 / -Filter: 원하는 것만 필터링하여 검색)
dir c:\windows\ -recurse -filter au*.dll
dir c:\windows -recurse -filter sam
dir c:\windows -recurse -filter hosts
dir $home -recurse -filter *.jpg
자신이 가지고 있는 음악 및 사진 파일들이 여러 폴더에 흩어져 있다면 dir $home -recurse -filter *.jpg 형식으로 찾아서 복사하면 된다.
dir $home -recurse -filter *.jpg | copy -destination d:\imsi
이렇게 하면 바탕화면 및 내 문서에 있는 모든 사진 파일을 D:\imsi 폴더로 몽땅 복사할 수 있다.
중요한 것은 상당히 빨리 작업이 이루어진다는 것이다.
출처 : http://cloudsns.wordpress.com/category/microsoft/powershell/page/11/
'powershell' 카테고리의 다른 글
원격 컴퓨터의 서비스를 중지하는 방법 (미확인) (0) | 2014.09.19 |
---|---|
Powershell v2.0에 Powershell v3.0을 설치했을 때 2.0을 사용하는 방법 ($PSVersionTable 사용하기) (0) | 2014.09.19 |
Powershell Web access in Windows Server 2012 (0) | 2014.09.19 |
Where-Object와 -Filter의 속도 차이 (0) | 2014.09.19 |
read-host와 write-host 사용하기 (0) | 2014.09.19 |