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

checking for if a file exists on a remote server.

Expand Messages
  • jonny 5
    I need to check to see if a file exists on a remote server. anyone here know how? will the -e filename work or do i need to do some other type of work
    Message 1 of 5 , Dec 30, 2000
    • 0 Attachment
      I need to check to see if a file exists on a remote server. anyone
      here know how?


      will the -e 'filename' work or do i need to do some other type of
      work around?

      Lee
    • Greg Webster
      ... Not sure if this is the easiest way, but you could use scp. Greg -- - - - - - - - - ...
      Message 2 of 5 , Dec 31, 2000
      • 0 Attachment
        On Sat, 30 Dec 2000, you wrote:
        > I need to check to see if a file exists on a remote server. anyone
        > here know how?

        Not sure if this is the easiest way, but you could use scp.

        Greg


        --
        < >-< >< >-< >< >-< >< >-< >< >-< >< >-< >< >-< >< >-< >< >
        | | | GREG WEBSTER - greg@... | | | |
        <_>-<_><_>-<_><_>-<_><_>-<_><_>-<_><_>-<_><_>-<_><_>-<_><_>
      • Randall Hobbs
        You can very easily check to see if a file exists like this: if (-e file ) { # Subroutine executed if file exists } If you need to check to see if a file
        Message 3 of 5 , Dec 31, 2000
        • 0 Attachment
          You can very easily check to see if a file exists like this:

          if (-e 'file') {
          # Subroutine executed if file exists
          }

          If you need to check to see if a file exists in another directory, be sure to include the full path (not the URL) so that the script can find it...

          Take care....
          Randall

          You have questions? We have answers...
          http://www.expert-html.com

          Are you in the Zone?
          http://www.wtv-zone.com
        • Randall Hobbs
          Oops.. Guess it would help to read the question eh? LOL. To check to see if a file exists on a remote server, try looking for the HEAD... #!/usr/bin/perl use
          Message 4 of 5 , Dec 31, 2000
          • 0 Attachment
            Oops.. Guess it would help to read the question eh? LOL.

            To check to see if a file exists on a remote server, try looking for the HEAD...

            #!/usr/bin/perl

            use LWP::Simple;

            if (head("http://www.domain.com/file")) {
            # File exists subroutine
            }

            Take care....
            Randall

            You have questions? We have answers...
            http://www.expert-html.com

            Are you in the Zone?
            http://www.wtv-zone.com
          • jonny_5
            Thank you MR. hobbs your solution works great. Lee ... From: Randall Hobbs [mailto:Mandrake981@msn.com] Sent: Sunday, December 31, 2000 3:43 AM To:
            Message 5 of 5 , Dec 31, 2000
            • 0 Attachment
              Thank you MR. hobbs

              your solution works great.

              Lee

              -----Original Message-----
              From: Randall Hobbs [mailto:Mandrake981@...]
              Sent: Sunday, December 31, 2000 3:43 AM
              To: perl-beginner@egroups.com
              Subject: Re: [PBML] checking for if a file exists on a remote server.


              Oops.. Guess it would help to read the question eh? LOL.

              To check to see if a file exists on a remote server, try looking for the
              HEAD...

              #!/usr/bin/perl

              use LWP::Simple;

              if (head("http://www.domain.com/file")) {
              # File exists subroutine
              }

              Take care....
              Randall

              You have questions? We have answers...
              http://www.expert-html.com

              Are you in the Zone?
              http://www.wtv-zone.com
            Your message has been successfully submitted and would be delivered to recipients shortly.