list files in a REMOTE dir and report back?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • news@celticbear.com

    list files in a REMOTE dir and report back?

    I'm needing a script I have to read a directory and list its contents,
    and opendir() would be perfect!



    Unfortunately, it's a folder on another server that I need it to check
    and report back the results for.
    Is that possible?
    I searched around the newsgroup and can't find anything on the topic.
    If it's possible, could someone just reply with the name of the concept
    I need to look at, like: "look into foo()" and just leave it at that
    and I'll go from there.

    Thanks for any assistance!
    Liam

  • Daniel Tryba

    #2
    Re: list files in a REMOTE dir and report back?

    news@celticbear .com wrote:
    [opendir][color=blue]
    > Unfortunately, it's a folder on another server that I need it to check
    > and report back the results for.
    > Is that possible?[/color]

    Yes it is possible, eg opendir on an NFS mounted dir is no problem
    (completly transparant to php).

    But since there are many ways one could try to access "a folder on an
    other machine" it might not be possible in your setup, so please
    elaborate what you mean with folder on an other machine!

    Comment

    • news@celticbear.com

      #3
      Re: list files in a REMOTE dir and report back?


      Daniel Tryba wrote:
      [color=blue]
      > But since there are many ways one could try to access "a folder on an
      > other machine" it might not be possible in your setup, so please
      > elaborate what you mean with folder on an other machine![/color]

      Very good point.

      Server A is a RedHatES2 machine running the primary Web server that
      would run the script.

      Server B is a Fedora Core2 machine with the drive in question. EXT3 (?)
      formatted drive. (Whatever the native Linux default format is.)

      Not quite sure what else to say. Both are behind separate firewalls
      with public IP's, and I can port forward as necessary.

      Thanks for the reply!

      Comment

      • Daniel Tryba

        #4
        Re: list files in a REMOTE dir and report back?

        news@celticbear .com wrote:[color=blue]
        > Server A is a RedHatES2 machine running the primary Web server that
        > would run the script.
        >
        > Server B is a Fedora Core2 machine with the drive in question. EXT3 (?)
        > formatted drive. (Whatever the native Linux default format is.)
        >
        > Not quite sure what else to say. Both are behind separate firewalls
        > with public IP's, and I can port forward as necessary.[/color]

        Since there is no actual filesystem from B mounted on A opendir on A
        isn't going to work. A couple of possible solutions:
        -"web service" on B
        -remote "commands"
        -VPN

        A VPN could make it possible to just mount (eg NFS or samba) the
        directory and let you use it on A as any normal filesystem.

        With remote command I mean something like ssh, on system A you'd do a
        system() that calls "ls /foo/bar/" on B and parse it's output (could
        even call php cli/cgi which returns serialzed info).

        With webservice I'm thinking of a webserver/php running on B that does
        the opendir()/readir(). It's collects the info and creates an array
        holding the data and spits it out as a valid PHP script which could be
        include()-ed on A.

        Comment

        Working...