파일 시스템용 Get-Item
업데이트 날짜: 2014년 5월
적용 대상: Windows PowerShell 2.0, Windows PowerShell 3.0, Windows PowerShell 4.0
파일과 폴더를 가져옵니다.
구문
Get-Item [-Stream <string>] [<CommonParameters>]
설명
파일 시스템에서 Get-Item cmdlet은 파일 및 폴더를 가져옵니다.
참고: 이 사용자 지정 cmdlet 도움말 파일은 파일 시스템 드라이브에서 Get-Item cmdlet의 작동 방식을 설명합니다. 모든 드라이브에서 Get-item cmdlet에 대한 자세한 내용을 보려면 "Get-HelpGet-Item -Path $null"을 입력하거나 Get-item(https://go.microsoft.com/fwlink/?LinkID=113319)(영문)을 참조하세요.
매개 변수
-Stream <string>
파일에서 지정된 대체 NTFS 파일 스트림을 가져옵니다. 스트림 이름을 입력합니다. 와일드카드가 지원됩니다. 모든 스트림을 가져오려면 별표(*)를 사용하세요. 이 매개 변수를 폴더에는 사용할 수 없습니다.
스트림은 파일 시스템 공급자가 Get-Item cmdlet에 추가하는 동적 매개 변수입니다. 이 매개 변수는 파일 시스템 드라이브에만 작동합니다.
이 매개 변수는 Windows PowerShell 3.0에서 도입되었습니다.
필수 여부 |
false |
위치 |
명명됨 |
기본값 |
대체 파일 스트림 없음 |
파이프라인 입력 적용 여부 |
false |
와일드카드 문자 허용 여부 |
false |
<CommonParameters>
이 cmdlet은 일반 매개 변수 -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction 및 -WarningVariable을 지원합니다. 자세한 내용은 about_CommonParameters를 참조하세요.
입력 및 출력
입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다. 반환 유형은 cmdlet에서 반환되는 개체의 유형입니다.
입력 |
System.String[ ] Get-Item cmdlet으로 경로를 파이프할 수 있습니다. |
출력 |
System.IO.FileInfo, System.IO.DirectoryInfo, Microsoft.PowerShell.Commands.AlternateStreamData 파일 시스템에서 Get-Item은 파일 및 폴더를 반환합니다. Stream 매개 변수를 사용하는 경우 AlternateStreamData 개체를 반환합니다. |
예제 1
C:\PS>Get-Item C:\Users\User01\Downloads\InternetFile.docx -Stream *
FileName: C:\Users\User01\Downloads\InternetFile.docx
Stream Length
------ ------
:$DATA 45056
Zone.Identifier 26
Description
-----------
This command gets all stream data from a file that was downloaded from the Internet. The Zone.Identifier stream identifies a file that originated on the Internet. The $DATA stream is the default.
The Stream parameter is introduced in Windows PowerShell 3.0.
예제 2
C:\PS>Get-Item C:\ps-test\* -Stream Zone.Identifier -ErrorAction SilentlyContinue
FileName: C:\ps-test\Copy-Script.ps1
Stream Length
------ ------
Zone.Identifier 26
FileName: C:\ps-test\Start-ActivityTracker.ps1
Stream Length
------ ------
Zone.Identifier 26
Description
-----------
This command gets Zone.Identifier stream data from all files in the C:\ps-test directory. The command uses the Stream parameter to specify the alternate stream and he ErrorAction parameter with a value of SilentlyContinue to suppress non-terminating errors that are generated when a file has no alternate data streams.
The Stream parameter is introduced in Windows PowerShell 3.0.
예제 3
C:\PS>Get-Item .
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 7/26/2006 10:01 AM ps-test
Description
-----------
This command gets the current directory. The dot (.) represents the item at the current location (not its contents).
예제 4
C:\PS>Get-Item *
Directory: C:\ps-test
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 7/26/2006 9:29 AM Logs
d---- 7/26/2006 9:26 AM Recs
-a--- 7/26/2006 9:28 AM 80 date.csv
-a--- 7/26/2006 10:01 AM 30 filenoext
-a--- 7/26/2006 9:30 AM 11472 process.doc
-a--- 7/14/2006 10:47 AM 30 test.txt
Description
-----------
This command gets the current directory of the C: drive. The object that is retrieved represents only the directory, not its contents.
예제 5
C:\PS>Get-Item C:\
Description
-----------
This command gets the items in the C: drive. The wildcard character (*) represents all the items in the container, not just the container.
In Windows PowerShell, use a single asterisk (*) to get contents, instead of the traditional "*.*". The format is interpreted literally, so "*.*" would not retrieve directories or file names without a dot.
예제 6
C:\PS>(Get-Item C:\Windows).LastAccessTime
Description
-----------
This command gets the LastAccessTime property of the C:\Windows directory. LastAccessTime is just one property of file system directories. To see all of the properties of a directory, type "(Get-Item <directory-name>) | Get-Member".
예제 7
C:\PS>Get-Item C:\Windows\*.* -Exclude w*
Description
-----------
This command gets items in the Windows directory with names that include a dot (.), but do not begin with w*. This command works only when the path includes a wildcard character (*) to specify the contents of the item.
See Also
Concepts
Other Resources
Add-Content
Clear-Content
Get-Content
Get-ChildItem
Get-Content
Get-Item
Remove-Item
Set-Content
Test-Path