LazyDreamy

관리자 | 글쓰기

LazyDreamy » Computer/Programming

[VB] 파일 경로 추출

드림 | 2008/10/25 10:56

'디렉토리 취득
Console.WriteLine( _
    System.IO.Path.GetDirectoryName( _
        "C:\My Documents\My Pictures\Test.jpg"))
'결과: C:\My Documents\My Pictures

'확장자 취득
Console.WriteLine( _
    System.IO.Path.GetExtension( _
        "C:\My Documents\My Pictures\Test.jpg"))
'결과: .jpg

'파일명 취득
Console.WriteLine( _
    System.IO.Path.GetFileName( _
        "C:\My Documents\My Pictures\Test.jpg"))
'결과: Test.jpg

'확장자 없이 파일명 취득
Console.WriteLine _
    (System.IO.Path.GetFileNameWithoutExtension( _
        "C:\My Documents\My Pictures\Test.jpg"))
'결과: Test

'최상위 루트 취득
Console.WriteLine( _
    System.IO.Path.GetPathRoot( _
        "C:\My Documents\My Pictures\Test.jpg"))
'결과: C:\

출처 : http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=45&MAEULNo=18&no=380&ref=380


덧 : 프로그램 이름 및 실행 경로 받아오기

System.Reflection.Assembly.GetExecutingAssembly.Location

2008/10/25 10:56 2008/10/25 10:56


태그 ,

(go to top)

◀ recent | 1 | ... 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | ... 369 | previous ▶