#currItem# [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => mxstu [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> #currItem#
#currItem#
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => mxstu [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 5 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> CFDIRECTORY - Macromedia ColdFusion

CFDIRECTORY - Macromedia ColdFusion

What I need to do is list the contents of a network directory as links on a webpage. The boss thinks the wait (10-15 sec) is too long for cfdirectory to execute and return the results. So i am scheduling a task to run cfdirectory nightly and write the results to a text file. And then query the text file from the webpage. My code: getfiles.cfc <cfcomponent> <cffunction name="getList" returnType="string"> <cfdirectory name="fileList" action="list" directory="\FS2\array2\sop\Doents\Manuals"> <cfreturn #ValueList(fileList.name)#> </cffunction> </cfcomponent> writefile.cfm <cfinvoke component="getFiles" method="getList" ReturnVariable ="theList"/> <cffile action="Write" file="C:\Inetpub\wwwroot\phone\manuals.txt" output="#theList#"> This works, but gives me a single line comma separated list like ...

  1. #1

    Default CFDIRECTORY

    What I need to do is list the contents of a network directory as links on a
    webpage. The boss thinks the wait (10-15 sec) is too long for cfdirectory to
    execute and return the results. So i am scheduling a task to run cfdirectory
    nightly and write the results to a text file. And then query the text file from
    the webpage.
    My code:

    getfiles.cfc
    <cfcomponent>
    <cffunction name="getList" returnType="string">
    <cfdirectory name="fileList"
    action="list"
    directory="\\FS2\array2\sop\Doents\Manuals">
    <cfreturn #ValueList(fileList.name)#>
    </cffunction>
    </cfcomponent>

    writefile.cfm
    <cfinvoke component="getFiles" method="getList" ReturnVariable ="theList"/>
    <cffile action="Write"
    file="C:\Inetpub\wwwroot\phone\manuals.txt"
    output="#theList#">

    This works, but gives me a single line comma separated list like this:
    manual1,manual2,manual3
    How would I retrieve this list and format it as a link like so:
    manual1
    manual2
    manual3

    <cfcomponent>
    <cffunction name="getList" returnType="string">
    <cfdirectory name="fileList"
    action="list"
    directory="\\FS2\array2\sop\Doents\Manuals">
    <cfreturn #ValueList(fileList.name)#>
    </cffunction>
    </cfcomponent>

    majickwolf Guest

  2. #2

    Default Re: CFDIRECTORY

    One way is to just loop through the list and create your links.

    <!---- not tested --->
    <cfloop list="#yourList#" index="currItem">
    <a href="#currItem#">#currItem#</a>
    </cfloop>
    mxstu Guest

  3. #3

    Default Re: CFDIRECTORY

    How about just doing this....

    When writing the manuals.txt file replace output with this
    output="#replaceNoCase(ValueList(fileList.name), ",",chr(13) &
    chr(10),"all")#"

    criticalim@hotmail.com Guest

  4. #4

    Default Re: CFDIRECTORY

    Thanks for the reply, unfortunately that confused me just a little more...lol.
    Lets try this way. I have a text file "manual.txt" with the following single
    line in it:

    manual1,manual2,manual3,manual4

    What is the best way to pull that info into a cfm page in the following format:
    <link>manual1</link>
    <link>manual2</link>
    <link>manual3</link>
    <link>manual4</link>

    majickwolf Guest

  5. #5

    Default Re: CFDIRECTORY

    Use cffile to read the contents of "manual.txt" into a variable named
    "yourList". So in your example the variable #yourList# would equal
    "manual1,manual2,manual3,manual4". Then use cfloop to output each individual
    item.

    <!--- not tested --->
    <cfloop list="manual1,manual2,manual3,manual4" index="currItem">
    <cfoutput><link>#currItem#</link><br></cfoutput>
    </cfloop>

    <!--- using variables .... --->
    <cfloop list="#yourList#" index="currItem">
    <cfoutput><link>#currItem#</link><br></cfoutput>
    </cfloop>



    mxstu Guest

Similar Threads

  1. cfdirectory
    By kt03 in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: July 13th, 07:21 AM
  2. Problem with cfdirectory
    By qgh in forum Coldfusion - Getting Started
    Replies: 6
    Last Post: July 14th, 06:07 PM
  3. How do I use CFtree and CFdirectory?
    By fvanstaveren in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: May 5th, 04:38 PM
  4. sorting in <cfdirectory>
    By joonstar in forum Macromedia ColdFusion
    Replies: 1
    Last Post: May 3rd, 10:59 AM

Bookmarks

Posting Permissions

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