change into a directory to create other folders/directory

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default change into a directory to create other folders/directory

    I need to create sub folders in a parent folder..

    i have ...

    <cfset session.parentdir = "e:\mainstuff\">


    <cfdirectory action="create" directory="#session.parentdir##getid.id#\new">
    <cfdirectory action="create" directory="#session.parentdir###getid.id#\bad">

    creats e:\mainstuff each time..

    how do i make this first go into the mainstuff

    THEN create getid\new ?



    sc Guest

  2. Similar Questions and Discussions

    1. Change Directory
      Currently Contribute is trying to get the site files out of the wrong folder ... how can I correct this?? I am not the site administrator but I do...
    2. How would I create a directory in ASP.NET?
      I've got a permission issue when I try to create a folder programmatically using C# in an ASP.NET web service. I've set ASP.NET user to have full...
    3. Active Directory Search fails ("The directory service is unavailab
      Hi all, I'm having one of those nerve wrecking errors, when trying to perform a simple search in an Active Directory. The objective of the code...
    4. Server cannot access application directory ... The directory does not exist or is not accessible because of security settings
      If you are using Windows XP in a Workgroup, rather than a Domain, then by default "Simple Filesharing" is turned on, and you won't see a security...
    5. Server cannot access application directory... The directory does not exist or is not accessible because of security settings.
      Hi, I have this issue with the error below. Let me explain my goal and my server environement: Goal: To have 3 separate web servers reading...
  3. #2

    Default Re: change into a directory to create otherfolders/directory

    creats e:\mainstuff each time..

    What do you mean creates it every time?
    mxstu Guest

  4. #3

    Default Re: change into a directory to create other folders/directory

    You have to check to see if mainstuff folder exists each time and then
    create another getit\new folder. This way you can be sure to create new
    folder each time.


    Jens


    "sc" <myis10_nospam_@covad.net> skrev i meddelandet
    news:dbdn7t$8q8$1@forums.macromedia.com...
    >I need to create sub folders in a parent folder..
    >
    > i have ...
    >
    > <cfset session.parentdir = "e:\mainstuff\">
    >
    >
    > <cfdirectory action="create"
    > directory="#session.parentdir##getid.id#\new">
    > <cfdirectory action="create"
    > directory="#session.parentdir###getid.id#\bad">
    >
    > creats e:\mainstuff each time..
    >
    > how do i make this first go into the mainstuff
    >
    > THEN create getid\new ?
    >
    >
    >

    Jens Hauser Guest

  5. #4

    Default Re: change into a directory to create otherfolders/directory

    You have to check to see if mainstuff folder exists each time...
    I tested this under MX 6.1, and it was not necessary to check or create the
    "mainstuff" directory first. That directory was automatically created when the
    first child directory was created.

    The attached code produced the following directory structure:
    d:\mainstuff\ ---- contents
    d:\mainstuff\23
    d:\mainstuff\89
    d:\mainstuff\92
    d:\mainstuff\23\bad
    d:\mainstuff\23\new
    d:\mainstuff\89\bad
    d:\mainstuff\89\new
    d:\mainstuff\92\bad
    d:\mainstuff\92\new



    <!--- create a test query with 3 records --->
    <cfset getID = queryNew("ID")>
    <cfset QueryAddRow(getID, 3)>
    <cfset QuerySetCell(getID, "ID", 23, 1)>
    <cfset QuerySetCell(getID, "ID", 89, 2)>
    <cfset QuerySetCell(getID, "ID", 92, 3)>

    <cfset session.parentdir = "d:\mainstuff\">

    <cfoutput query="getID">
    <cfif NOT DirectoryExists("#session.parentdir##getid.id#\new ")>
    <cfdirectory action="create" directory="#session.parentdir##getid.id#\new">
    </cfif>
    <cfif NOT DirectoryExists("#session.parentdir##getid.id#\bad ")>
    <cfdirectory action="create" directory="#session.parentdir##getid.id#\bad">
    </cfif>
    </cfoutput>

    mxstu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139