Method of creating multi-level directory folder recursively by vbs

Time:2021-10-14

Core code

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CreateFolders "d:\zzvipstest\1\2\3\4\5"
 
Function CreateFolders(path)
    Set fso = CreateObject("scripting.filesystemobject")
    CreateFolderEx fso,path
    set fso = Nothing
End Function
 
Function CreateFolderEx(fso,path)
    If fso.FolderExists(path) Then
        Exit Function
    End If
    If Not fso.FolderExists(fso.GetParentFolderName(path)) Then
        CreateFolderEx fso,fso.GetParentFolderName(path)
    End If
    fso.CreateFolder(path)
End Function

After testing, the operation is OK

Method of creating multi-level directory folder recursively by vbs

The two functions in this article link the createfolder method and the getparentfoldername method.

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]