Announcement

Collapse
No announcement yet.

VBScript Directory !!!!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    VBScript Directory !!!!

    How in VBScript can I test if a directory exists and how can I create it if it doesn't exist...

    I search in msdn librairy about that but I found nothing

    #2
    Look in your local copy of the windows script documentation regarding FSO (filesystemobject). Within the sample code is exactly what you are looking for. The attached may not work 100% as is, but has the items you asked about.

    <pre class="ip-ubbcode-code-pre">
    Dim FSO
    Dim TestFilePath
    TestFilePath = "C:\somepath\somesubfolder"
    Set FSO = CreateObject("Scripting.FileSystemObject")

    If FSO.FolderExists(TestFilePath) Then
    ' path already exists
    else
    Set TestFolder = FSO.CreateFolder(TestFilePath)
    end if
    Set SubFolders = TestFolder.SubFolders
    Set SubFolder = SubFolders.Add("Beatles")
    </pre>
    huggy_d1

    Automating made easy

    Comment

    Working...
    X