Results 1 to 2 of 2

Thread: Quickest way to extract a filename and parent folder name from a path string?

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jan 2015
    Posts
    4

    Quickest way to extract a filename and parent folder name from a path string?

    I know there is a lot methods to do this. Basically via string functions but what is the quickest way? And also what is the quickest for file extensions?

  2. #2
    gibra
    Guest

    Re: Quickest way to extract a filename and parent folder name from a path string?

    One methods:

    Code:
        Dim sPath As String
        Dim sFileName As String
        Dim sExtension As String
        Dim sFolder As String
        
        sPath = "D:\Common\Tools\vb\Unsupprt\MCIWinDx\mciwindx.doc"
        
        sFileName = Right$(sPath, Len(sPath) - InStrRev(sPath, "\"))
        sExtension = Right$(sPath, Len(sPath) - InStrRev(sPath, "."))
        sFolder = Left$(sPath, Len(sPath) - Len(sFileName))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width