Loading ...
Sorry, an error occurred while loading the content.

Using GetFiles to find folders

Expand Messages
  • warner_hughes
    I have tried every combination I can think of to use ^$GetFiles()$ to make a list of folders, using the attr D , per the Help file. Using other attributes I
    Message 1 of 2 , Dec 8, 2012
    • 0 Attachment
      I have tried every combination I can think of to use ^$GetFiles()$ to make a list of folders, using the attr "D", per the Help file. Using other attributes I can find files perfectly, including finding files in the folders, but making a list of folder names escapes me.

      The second line of code (currently commented out) works fine, but the next line comes up with nothing. I've tried many ways to modify the 3rd line to come up with the folders only. What changes will make it work?

      ^!Set %webdir%="^$GetShellFolder(Personal)$My Webs"
      ;^!SetArray %projects%=^$GetFiles("+^%webdir%";*.htm?)$
      ^!SetArray %projects%=^$GetFiles("^%webdir%";;D)$

      My searches don't show anyone has had a problem with this. Can anyone help, please?
      Warner
    • flo.gehrke
      ... There is no D parameter to be used with ^$GetFiles$. I would propose to try two solutions: (1) Using ^$GetFiles$ (needs NT 7.0) ^!Set
      Message 2 of 2 , Dec 8, 2012
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "warner_hughes" <whug@...> wrote:
        >
        > I have tried every combination I can think of to use ^$GetFiles()$
        > to make a list of folders, using the attr "D", per the Help file.

        There is no 'D' parameter to be used with ^$GetFiles$.

        I would propose to try two solutions:

        (1) Using ^$GetFiles$ (needs NT 7.0)

        ^!Set %Dirs%=^$GetFiles("+[Path]";nul)$
        ^!Set %Dirs%=^$StrReplace(""^%Space%"";";";"^%Dirs%";A)$
        ^!Set %Dirs%=^$StrReplace("nul";"";"^%Dirs%";A)$
        ;^!Set %Dirs%=^$StrSort("^%Dirs%";0;1;0)$
        ^!SetArray %projects%=^%Dirs%

        (2) Using ^$GetDosOutput$

        ^!SetArray %projects%=^$GetDosOutput(dir [Path]\*.* /A:D /B)$

        This certainly needs some fine-tuning -- but I hope it could serve as a first approach...

        Regards,
        Flo

        P.S. #1 is based on some ideas in Jody's (R.I.P) DirStuff.CLB
      Your message has been successfully submitted and would be delivered to recipients shortly.