파일 액세스 - 파일, 디렉토리 및 드라이브 속성
파일의 정보는 My.Computer.FileSystem.GetFileInfo 메서드를 사용하여 확인한다.
FileInfo 개체의 속성에는 특성, 만든시간, 디렉터리, 디렉터리 이름, 존재 여부, 확장명, 전체 이름, 마지막 액세스 시간, 마지막 수정 시간, 길이 및 이름이 포함되어 있다.
Dim information As System.IO.FileInfo
information = My.Computer.FileSystem.GetFileInfo("C:\MyLogFile.log")
디렉토리의 정보는 My.Computer.FileSystem.GetDirectoryInfo 메서드를 사용하여 확인한다.
Dim getInfo As System.IO.DirectoryInfo
getInfo = My.Computer.FileSystem.GetDirectoryInfo("C:\Documents and Settings")
MsgBox("The directory was created at " & getInfo.CreationTime)
컴퓨터 드라이브에 대한 정보는 My.Computer.FileSystem.GetDriveInfo 메서드를 사용하여 확인한다.
Dim cdrive As System.IO.DriveInfo
cdrive = My.Computer.FileSystem.GetDriveInfo("C:\")
MsgBox(cdrive.DriveFormat)
My.Computer.FileSystem.SpecialDirectories 속성 개체는 일반적으로 참조되는 디렉토리에 액세스할 수 있는 속성을 제공한다.
- AllUserApplicationData : All Users Application Data 디렉토리의 경로 이름을 나타내는 읽기 전용 String
- CurrentUserApplicationData : 현재 사용자의 Application Data 디렉토리 경로 이름을 나타내는 읽기 전용 String
- Desktop : 사용자의 Deskop 디렉토리 경로 이름을 나타내는 읽기 전용 String
- MyDocuments : 사용자의 MyDocuments 디렉토리 경로 이름을 나타내는 읽기 전용 String
- MyMusic : 사용자의 MyMusic 디렉토리 경로 이름을 나타내는 읽기 전용 String
- MyPictures : 사용자의 MyPictures 디렉토리 경로 이름을 나타내는 읽기 전용 String
- Programs : 사용자의 Programs 디렉토리 경로 이름을 나타내는 읽기 전용 String
- Temp : 사용자의 Temp 디렉토리 경로 이름을 나타내는 읽기 전용 String