Getting directory contests using DIR

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sonnich

    Getting directory contests using DIR

    Hi all

    I was wondering to try something like this:

    exec("dir \"".$sSearchPat h."\\*.pdf\" >c:\hhh.txt") ;

    though, it hangs at that point. I tried system(), shell_exec/() etc
    similar result.

    Have anyone tried this?

    S

  • Michael Cooney

    #2
    Re: Getting directory contests using DIR

    Don't execute shell commands to do this. In PHP5 use
    http://php.net/scandir, in PHP4 use http://php.net/readdir.

    Sonnich wrote:
    Hi all
    >
    I was wondering to try something like this:
    >
    exec("dir \"".$sSearchPat h."\\*.pdf\" >c:\hhh.txt") ;
    >
    though, it hangs at that point. I tried system(), shell_exec/() etc
    similar result.
    >
    Have anyone tried this?
    >
    S

    Comment

    • Sonnich

      #3
      Re: Getting directory contests using DIR

      The idea is to speed it up, when e.g. as now, reading that 126 times,
      it becomes slow.
      The idea is to create this file, and check the time for it. When it is
      "new", I can use it for checking whether certain files are presnt, and
      run the dir only once.
      It is much faster to read in a txt file than running the opendir
      request again.

      Current I run it 126 with the present values - orders. They might
      change, but since a large amount of those are similar, they might be in
      the same places.

      Anyway, I found that a small test programme with this works, while a my
      current software does not like it, and stops at that point.

      BR
      Sonnich

      Michael Cooney wrote:
      Don't execute shell commands to do this. In PHP5 use
      http://php.net/scandir, in PHP4 use http://php.net/readdir.
      >
      Sonnich wrote:
      Hi all

      I was wondering to try something like this:

      exec("dir \"".$sSearchPat h."\\*.pdf\" >c:\hhh.txt") ;

      though, it hangs at that point. I tried system(), shell_exec/() etc
      similar result.

      Have anyone tried this?

      S

      Comment

      • Michael Cooney

        #4
        Re: Getting directory contests using DIR

        What's stopping you from writing the results of readdir to a file from
        within PHP?

        Sonnich wrote:
        The idea is to speed it up, when e.g. as now, reading that 126 times,
        it becomes slow.
        The idea is to create this file, and check the time for it. When it is
        "new", I can use it for checking whether certain files are presnt, and
        run the dir only once.
        It is much faster to read in a txt file than running the opendir
        request again.
        >
        Current I run it 126 with the present values - orders. They might
        change, but since a large amount of those are similar, they might be in
        the same places.
        >
        Anyway, I found that a small test programme with this works, while a my
        current software does not like it, and stops at that point.
        >
        BR
        Sonnich
        >
        Michael Cooney wrote:
        Don't execute shell commands to do this. In PHP5 use
        http://php.net/scandir, in PHP4 use http://php.net/readdir.

        Sonnich wrote:
        Hi all
        >
        I was wondering to try something like this:
        >
        exec("dir \"".$sSearchPat h."\\*.pdf\" >c:\hhh.txt") ;
        >
        though, it hangs at that point. I tried system(), shell_exec/() etc
        similar result.
        >
        Have anyone tried this?
        >
        S

        Comment

        • Sonnich

          #5
          Re: Getting directory contests using DIR


          Michael Cooney wrote:
          What's stopping you from writing the results of readdir to a file from
          within PHP?
          It is slow.

          I found a problem - while this works:
          exec("dir c:\\*.* >".dirname(__FI LE__)."\\hh.txt ");

          then this does not

          exec("dir \\\\some_server \\dir1\\dir2\\* .*
          >".dirname(__FI LE__)."\\hh.txt ");
          it does not like the server path.... hmmm might wannt look at the
          server....

          S

          >
          Sonnich wrote:
          The idea is to speed it up, when e.g. as now, reading that 126 times,
          it becomes slow.
          The idea is to create this file, and check the time for it. When it is
          "new", I can use it for checking whether certain files are presnt, and
          run the dir only once.
          It is much faster to read in a txt file than running the opendir
          request again.

          Current I run it 126 with the present values - orders. They might
          change, but since a large amount of those are similar, they might be in
          the same places.

          Anyway, I found that a small test programme with this works, while a my
          current software does not like it, and stops at that point.

          BR
          Sonnich

          Michael Cooney wrote:
          Don't execute shell commands to do this. In PHP5 use
          http://php.net/scandir, in PHP4 use http://php.net/readdir.
          >
          Sonnich wrote:
          Hi all

          I was wondering to try something like this:

          exec("dir \"".$sSearchPat h."\\*.pdf\" >c:\hhh.txt") ;

          though, it hangs at that point. I tried system(), shell_exec/() etc
          similar result.

          Have anyone tried this?

          S

          Comment

          Working...