본문 바로가기
유용한 정보/· PowerShell

파일 찾기 및 백업

by 넷둥이파파 2014. 9. 15.

 

 

■ 원문링크 :

 

Get-childitem

 

 

# 특정폴더 내 모든파일 검색 

PS C:\Users\oseung.chae> Get-ChildItem "D:\temp" -Recurse -Include *.*

 

# 특정폴더 내 날짜조건 검색 (2014-09-15 이후)

PS C:\Users\oseung.chae> Get-ChildItem "D:\temp" -Recurse -Include *.* | Where-Object {($_.LastwriteTime -gt "2014-09-15") -and ($_.CreationTime -gt "2014-09-15")}

 

# 특정폴더 내 이름조건 검색 (test)

PS C:\Users\oseung.chae> Get-ChildItem "D:\temp" -Recurse -Include *.* | Where-Object -FilterScript{$_.ToString() -match "test"}

 

# 특정폴더 내 파일 백업

PS C:\Users\oseung.chae> Get-ChildItem "D:\temp" -Recurse -Include *.* | Where-Object -FilterScript{$_.ToString() -match "100.5.136.1"} | Copy-Item -Destination "D:\temp2" -recurse -Force

 

 

 

 

 

 

get-help Get-childitem

 

이름
    Get-ChildItem
   
개요
    하나 이상의 지정된 위치에서 항목 및 하위 항목을 가져옵니다.
   
   
구문
    Get-ChildItem [[-Path] <string[]>] [[-Filter] <string>] [-Exclude <string[]>] [-Force] [-Include <string[]>] [-Name] [-Recurse] [-UseTransaction] [<CommonParame
    ters>]
   
    Get-ChildItem [-LiteralPath] <string[]> [[-Filter] <string>] [-Exclude <string[]>] [-Force] [-Include <string[]>] [-Name] [-Recurse] [-UseTransaction] [<CommonP
    arameters>]
   
   
설명
    Get-ChildItem cmdlet은 하나 이상의 지정된 위치에서 항목을 가져옵니다. 항목이 컨테이너인 경우 컨테이너 내에 있는 항목(하위 항목이라고 함)을 가져옵니다. Recurse 매개 변수를 사용하여 모든 하위 컨테이너의 항목을 가져올 수 있습니다.
   
    위치는 파일 시스템 위치(예: 디렉터리) 또는 다른 공급자에서 제공하는 위치(예: 레지스트리 하이브 또는 인증서 저장소)일 수 있습니다.
   

관련 링크
    Online version: http://go.microsoft.com/fwlink/?LinkID=113308
    about_Providers
    Get-Item
    Get-Alias
    Get-Location
    Get-Process

설명
    예를 보려면 다음과 같이 입력하십시오. "get-help Get-ChildItem -examples".
    자세한 내용을 보려면 다음과 같이 입력하십시오. "get-help Get-ChildItem -detailed".
    기술적인 내용을 보려면 다음과 같이 입력하십시오. "get-help Get-ChildItem -full".

------------------------------------------------------------------------------------------------------

 

get-help copy-item

 

이름
    Copy-Item
   
개요
    네임스페이스 내의 다른 위치로 항목을 복사합니다.
   
   
구문
    Copy-Item [-LiteralPath] <string[]> [[-Destination] <string>] [-Container] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Incl
    ude <string[]>] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]
   
    Copy-Item [-Path] <string[]> [[-Destination] <string>] [-Container] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <st
    ring[]>] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]
   
   
설명
    Copy-Item cmdlet은 네임스페이스 내의 다른 위치로 항목을 복사합니다. Copy-Item은 복사하는 항목을 삭제하지는 않습니다. Cmdlet이 복사할 수 있는 특정 항목은 사용 가능한 Windows PowerShell 공급자에 따라 다릅니다. 예를 들어 파일 시스템 공급자와
    함께 사용할 경우 파일 및 디렉터리를 복사하고 레지스트리 공급자와 함께 사용할 경우 레지스트리 키 및 항목을 복사할 수 있습니다.
   

관련 링크
    Online version: http://go.microsoft.com/fwlink/?LinkID=113292
    about_Providers
    Clear-Item
    Get-Item
    Invoke-Item
    Move-Item
    Set-Item
    New-Item
    Remove-Item
    Rename-Item

설명
    예를 보려면 다음과 같이 입력하십시오. "get-help Copy-Item -examples".
    자세한 내용을 보려면 다음과 같이 입력하십시오. "get-help Copy-Item -detailed".
    기술적인 내용을 보려면 다음과 같이 입력하십시오. "get-help Copy-Item -full".