#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    156
    Rep Power
    21

    CFDIRECTORY recurse throwing error.


    I'm trying to do a recursive list through a directory. My end goal is to index these results. I'm running into some issues right now though.

    Here is the code i'm using
    Code:
    <cfdirectory action="list" name="stuffs" directory="s:\" type="all" listinfo="all" recurse="yes">
    I know, I know i'm not using a UNC path, that will get fixed.

    The error it throws isI tried to post an image but it didn't work)
    500 internal server error:

    The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
    Null Pointers are another name for undefined values.






    The error occurred in C:\inetpub\scripts\SOLR\Intranet_search.cfm: line 8

    6 :
    7 :
    8 : <cfdirectory action="list" name="stuffs" directory="s:\" type="all" listinfo="all" recurse="yes">
    9 :
    10 :
    Now when I turn recurse to no, it doesn't throw an error. I don't have read permissions on all the folders in the s:\ would that be causing issues? I'm kind of stuck here any ideas would be great.

    Thanks,
    DSFX
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    Yes, you absolutely would need at least read permissions on the folder and its children.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    156
    Rep Power
    21
    Originally Posted by kiteless
    Yes, you absolutely would need at least read permissions on the folder and its children.
    So for example I have "Folder A" and "Folder B". On Folder A I have read permissions on everything inside and i'm able to do a recursive read on it. Folder B I have read permissions on all but one folder inside. I can do a normal CFDIRECTORY LIST and it'll work and show everything but when I use the recursive option it errors out on me.

    I thought it would just skip the folder it didn't have read on.

    Thanks,
    DSFX
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    That's because a simple one-level list doesn't care what the permissions are on the subdirectories. But with recurse, it actually tries to list the contents of the subdirectories. That's where the error happens.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    156
    Rep Power
    21
    Originally Posted by kiteless
    That's because a simple one-level list doesn't care what the permissions are on the subdirectories. But with recurse, it actually tries to list the contents of the subdirectories. That's where the error happens.
    That's what I was afraid of. What I'm doing is scanning a directory the staff save files too. There are a few directories in there like an Admin one that staff don't have access too. The credentials I'm using to do the scan have staff level permissions since I don't want to index more personal things that the managers here keep.

    Given the circumstances is there something I can do to index this directory?

    Thanks for your help,
    DSFX.
  10. #6
  11. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    I assume you're not on CF 10, since this is listed as a fixed defect (https://bugbase.adobe.com/index.cfm?...bug&id=3195198).

    The only other options I can think of are:

    • Try using the underlying Java file classes
    • Do the recursion manually, doing a cfdirectory list, finding the directories, looping over those, and continuing to recurse until there are no more directories. Wrap each list in a try/catch so you can catch the permission error and keep going.

    Comments on this post

    • dsfx agrees : Solid find.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    156
    Rep Power
    21
    That's the bug. I'm on 9.0.1 good find. Next time I'll check the bugbase.

    I was half way done writing the recursion manually but wondered if there may be a faster/easier way... guess not haha.

    As always,

    Thanks Kite.

IMN logo majestic logo threadwatch logo seochat tools logo