listing a Directory files

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

  1. #1

    Default listing a Directory files

    hello community
    i want to make a directory list
    i have pdf documents in a list
    101_4326.pdf
    101_4325.pdf
    201_4324.pdf
    201_4328.pdf
    but i only want to show the pdf that have the same number that the client
    example: id_client = 101 and the pdf is
    101_4326.pdf how can i show the files and associate the files with the id?

    menotti08 Guest

  2. Similar Questions and Discussions

    1. Directory listing
      Hi php-general, I'm reading through the filesystem function of php and I can't find any function which will list me all the files which are in a...
    2. retrieving directory listing
      I'm looking for a way to read the contents of a directory from within FlashMX. For example, I'd like to Flash to be able to store a listing of...
    3. Listing aliased directory
      I have in Apache2 (win32) aliased directory, for example: Alias /ftp/mp3/ "D:/mp3/" <Directory "D:/mp3"> .... </Directory> Address to this...
    4. [PHP] directory listing
      Wrong place, look at directory functions ;) Matthias Wulkow wrote:
    5. CD Directory Listing
      Is it possible to get the Directory listing from a CD in order to write it to a searchable database? If so does anyone know where I can get this...
  3. #2

    Default Re: listing a Directory files

    menotti08 wrote:
    > hello community
    > i want to make a directory list
    > i have pdf documents in a list
    > 101_4326.pdf
    > 101_4325.pdf
    > 201_4324.pdf
    > 201_4328.pdf
    > but i only want to show the pdf that have the same number that the client
    > example: id_client = 101 and the pdf is
    > 101_4326.pdf how can i show the files and associate the files with the id?
    >
    You can probably use the filter function to do that (I'd have to
    experiment to be sure):
    [url]http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-a20.htm#wp1097918[/url]

    I would think the filter could be something like #clientid#*

    If not, cfdirectory returns a query object and you could run a query of
    that query to filter.

    Matt
    --
    Matt Woodward
    [email]mpwoodward@gmail.com[/email]
    Team Macromedia - ColdFusion
    mpwoodward *TMM* Guest

  4. #3

    Default Re: listing a Directory files

    Try this:

    <cfset id_client = "101">
    <cfdirectory action="list" name="Qdir"
    directory="C:\directory_path_to_pdf_files">
    <cfquery dbtype="query" name="listfiles">
    SELECT Name
    FROM Qdir
    WHERE (Name LIKE '#id_client#%')
    </cfquery>
    <cfdump var="#listfiles#">




    Abinidi Guest

  5. #4

    Default Re: listing a Directory files

    iu think this can help me thx
    but i have to test it first
    thx for your help
    i will mark this when i test it

    sorry for my english
    menotti08 Guest

  6. #5

    Default Re: listing a Directory files

    ok i have problems with this
    <cfset DirList = "C:\Inetpub\wwwroot\test\pdf">

    <cfset id_client = "101">
    <cfdirectory action="list" name="Qdir" directory="DirList">
    <cfquery dbtype="query" name="listfiles" result="menotti">
    SELECT 101
    FROM Qdir
    <!--- WHERE (Name LIKE '#id_client#%') --->
    </cfquery>
    <cfoutput>#menotti.sql#</cfoutput>
    <cfdump var="#listfiles#">
    <cfoutput query="listfiles">#dirllist#</cfoutput>

    the application dont show the conent of the carpet
    the other problem is that i only want
    that the application recognize the number 101, or 201 or any number that i
    have in the file using the id, so i dont have to put <cfset id_client = "101">



    menotti08 Guest

  7. #6

    Default Re: listing a Directory files

    There are a few things wrong with what you have.
    If you use a variable in the CFDIRECTORY to define the path, you have to wrap
    it in #.
    Your WHERE clause, commented out, is correct. Remove the comments.
    Remove the RESULTS attribute in the CFQUERY. ColdFusion (at least version 5)
    does not recognize this.
    Change the way you are displaying your results. I have shown a CFOUTPUT loop
    of the filename.
    I removed the CFDUMP and the CFOUTPUT loop at the end of your code.


    <cfset DirList = "C:\Inetpub\wwwroot\test\pdf">

    <cfset id_client = "101">
    <cfdirectory action="list" name="Qdir" directory="#DirList#">
    <cfquery dbtype="query" name="listfiles">
    SELECT 101
    FROM Qdir
    WHERE (Name LIKE '#id_client#%')
    </cfquery>
    <cfoutput>#name#<BR></cfoutput>

    jdeline 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