【フォルダ作成(再帰処理)(VBS版)】


Option Explicit
 
'フォルダが既に存在している場合は何もしない
Public Function CreateDirectry( _
    ByVal sDirPath _
)
    Dim sParentDir
    Dim oFileSys
 
    Set oFileSys = CreateObject("Scripting.FileSystemObject")
 
    sParentDir = oFileSys.GetParentFolderName(sDirPath)
 
    '親ディレクトリが存在しない場合、再帰呼び出し
    If oFileSys.FolderExists( sParentDir ) = False Then
        Call CreateDirectry( sParentDir )
    End If
 
    'ディレクトリ作成
    If oFileSys.FolderExists( sDirPath ) = False Then
        oFileSys.CreateFolder sDirPath
    End If
 
    Set oFileSys = Nothing
End Function
 

最終更新:2016年09月23日 23:12