Results 1 to 6 of 6

Thread: How to Create a Directory

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2003
    Location
    Hyderabad
    Posts
    46

    How to Create a Directory

    Hello...

    How to create a directory at runtime... with the name given in textbox... in the app.path...

    and how to create the database.. douplicate.... (dump).... in that new (created) folder...

    thanks in advance...
    satyarao

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    MkDir for the directory

  3. #3
    Addicted Member
    Join Date
    Jan 2002
    Posts
    144

    try the following code and reply

    to create a directory runtime:
    mkdir app.path & "\" & text1.text

  4. #4
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    VB Code:
    1. Public Sub subCreateFolger(PathName As String)
    2.    
    3.     If Right(PathName, 1) = "\" Then
    4.        PathName = Left(PathName, Len(PathName) - 1)
    5.     End If
    6.    
    7.     Dim Curdirname As String
    8.    
    9.     On Local Error GoTo ErrHandler
    10.    
    11.        Curdirname = CurDir
    12.        ChDir PathName
    13.        ChDir Curdirname
    14.        Exit Sub
    15.    
    16. ErrHandler:
    17.        If Err = 76 Then
    18.           MkDir PathName
    19.           Resume Next
    20.        End If
    21.        Resume Next
    22.  
    23. End Sub
    oh1mie/Vic


  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2003
    Location
    Hyderabad
    Posts
    46

    Thanks

    Thank you very much... for your guidence...

    It is working perfectly... as I wished...
    and is there any way to overwrite an existing directory...?
    if the directory already exists... it should be removed with confirmation... and new one should be created...
    [ is there any way to Delete a directory thru vb program...?]

    And one more thing i would like to ask... that...
    i am having a file... named "project.mdb" in the app.path.
    i want to copy the file in to newly created directory...

    in current directory there is a file project.mdb
    i want to create new directory...
    let us suppose... MyDir, this directory should consists of project.mdb file.

    waiting for reply...
    satyarao

  6. #6

    Thread Starter
    Member
    Join Date
    Mar 2003
    Location
    Hyderabad
    Posts
    46

    I got it

    Hai...

    I got the answer to my question...

    it is nothing but... Filecopy method.


    i.e.

    SourceFile as string
    DestinationFile as string

    FileCopy SourceFile, DestinationFile

    --------------------------------------------------------
    FileCopy "C:\abc.txt", "C:\Temp\abc.txt"
    --------------------------------------------------------
    satyarao

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