VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Checks and restore Directory Structure for a file to copy

by Andrew Shelomanov (3 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 19th April 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Checks and restore Directory Structure for a file to copy

Rate Checks and restore Directory Structure for a file to copy



'   Automatically Checks and Creates Directory Structure
'   Parameters sFileName - Full File Path (eg. c:\aaa\ddd\aa.txt"
'
Public Sub CheckDirStructure(sFileName As String)
    Dim iPosCurrent As Integer, iPosStart As Integer, s As String
    iPosStart = 1
    iPosCurrent = InStr(iPosStart, sFileName, "\")
    
    Do Until iPosCurrent = 0
        s = Left(sFileName, iPosCurrent)
        If Dir(s, vbDirectory) = "" Then MkDir (s)
        iPosStart = iPosCurrent + 1
        iPosCurrent = InStr(iPosStart, sFileName, "\")
    Loop
End Sub


Download this snippet    Add to My Saved Code

Checks and restore Directory Structure for a file to copy Comments

No comments have been posted about Checks and restore Directory Structure for a file to copy. Why not be the first to post a comment about Checks and restore Directory Structure for a file to copy.

Post your comment

Subject:
Message:
0/1000 characters