Listing contents of a directory folder to contents ofdirectory

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Listing contents of a directory folder to contents ofdirectory

    cfdirectory listing... Here is my problem... I am listing directorys and when
    each directory is listed I want to list the contents of that directory. If you
    visit my site. [url]www.timothyrubel.com[/url] you will see that I am able to create a
    list of directorys and to list the contents of each directory individually but
    how can I do this so that the contents of each folder is generated when that
    folder is selected? -Tim

    <cfset thisPath = ExpandPath("upload/")>
    <cfset thisFolder = GetDirectoryFromPath(thisPath)>
    <cfset site = ("http://timothyrubel.com/upload/")>
    <cfdirectory directory="#thisFolder#" name="test" action="list" sort="name
    ASC, size DESC">
    <cfquery dbtype="query" name="dirsOnly">
    SELECT * FROM test WHERE TYPE='Dir'</cfquery>

    <cfoutput> <cfloop query="dirsOnly"> <a href="#site##dirsOnly.name#"
    class="style1">#dirsOnly.Name#</a><br>
    </cfloop>
    </cfoutput>


    <cfset thisPhoto = ExpandPath("Images/intranet/")>
    <cfset photo = GetDirectoryFromPath(thisPhoto)>
    <cfset root = ("http://timothyrubel.com/Images/intranet/")>
    <!--- <cfset photo = ("C:\Inetpub\wwwroot\timothyrubel\www\Images\intra net")>
    --->
    <cfdirectory directory="#photo#" name="dirlist" action="list"
    sort="datelastmodified desc">

    <cfquery dbtype="query" name="getimages">
    SELECT * From dirlist
    ORDER BY Name
    </cfquery>
    <html>

    <cfoutput>
    <cfloop query="getimages"> <a href="#root##getimages.Name#"
    class="style1"><img src="#root##getimages.Name#">#getimages.Name#</a> <br>
    </cfloop>
    </cfoutput>

    Rubex_Cube Guest

  2. Similar Questions and Discussions

    1. Folder contents upload?
      We replace our photo albums weekly on the company website. We have not figured out how to upload a folder's contents with Contribute - uploading all...
    2. cfdirectory - linking directory folder to contents ofdirectory.
      cfdirectory listing... Here is my problem... I am listing directorys and when each directory is listed I want to list the contents of that...
    3. showing folder contents
      looking for a way to show a folders contents in a CFM page. Saying a user puts a document in a folder and some CF page automatically lists on the...
    4. Can This be done? Dynamic jump menus listing folder contents!
      Hello all, We have: MS Advanced server2000 ASP MS SQL latest stable: PHP Active Perl
    5. rsync exclude file - directory name without directory contents
      When using rsync to maintain incremental backups significant space can be saved on the backup server by excluding directories that have non-critical...
  3. #2

    Default Re: Listing a directory folder and linking to thecontents of that directory

    Not sure I understand your question. Are you saying that you want the contents
    of the folders to appear when you're clicking the links generated with this
    code: <cfoutput> <cfloop query='dirsOnly'> <a href='#site##dirsOnly.name#'
    class='style1'>#dirsOnly.Name#</a><br> </cfloop> </cfoutput> If so, you web
    server needs to be confitured to allow directory browsing or you need to create
    another page that receives a directory name as an example, does a <cffile
    action='read' directory='#url.directory#'> on that directory, and then loops
    over the results.

    JonathanBigelow Guest

  4. #3

    Default Re: Listing a directory folder and linking to thecontents of that directory

    No, I can generate the list... in fact I am generating a list of only
    directorys.... from the root directory... as in my example at timothyrubel.com
    you will see upload 1, upload 2, upload 3, upload 4... those are folders and
    inside those folders there are files. I want to go a step farther and when a
    person clicks on the selected folder / link the selection lists the contents of
    that selected folder.

    Rubex_Cube 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