in reply to Re: Can I use Perl to move an entire HTML file on a different server?
in thread Can I use Perl to move an entire HTML file on a different server?

Thanks, but the problem I have is referencing the file on the server as this is diferent from the server I am running the script on, this is my move statement at the moment:

use Win32::ODBC; use File::Copy; move ("http://wwwdev/streams/$Config{'Author'}/$Config{'Ref'}", "http +://wwwybs/ybsone/pipeline/master/13Apr/$Config{'Ref'}") or die "move +failed: S!";
Have I referenced the file names in the right way (i.e. is http://wwwdev/streams' the correct way to refer to the file)?

This currently fails for reasons that I don't know.

I'm not on wwwdev when I run the script BTW.

  • Comment on Re^2: Can I use Perl to move an entire HTML file on a different server?
  • Download Code

Replies are listed 'Best First'.
Re^3: Can I use Perl to move an entire HTML file on a different server?
by Corion (Patriarch) on Apr 13, 2006 at 09:58 UTC

    The HTTP protocol cannot move or write files. Your idea cannot work. You need to have access to the file system of the target machine.

    Maybe you can use UNC names like this:

    my $machine = 'wwwdev'; my $sharename = 'wwwshare'; my $source = "\\\\$machine\\$sharename\\source\\directory\\filename.tx +t"; my $target = "\\\\$machine\\$sharename\\target\\directory\\new_filenam +e.txt"; rename $source, $target or die "Couldn't move '$source' to '$target' : $!";
      The HTTP protocol cannot move or write files

      well, actually, it can, the PUT method allows to upload files and the HTTP WebDAV extension adds suport for most filesystem operations.

        Yes, but I'm not using HTTP in that way, just as part of a file address.
      Thanks that almost works!

      I'm getting permission denied now

      This is my code now:

      my $machine = 'ybslint01'; my $sharename1 = 'wwwdev'; my $sharename2 = 'wwwybs'; my $source = "\\\\$machine\\$sharename1\\streams\\$Config{'Author'}\\$ +Config{'Ref'}"; my $target = "\\\\$machine\\$sharename2\\ybsone\\pipeline\\master\\13A +pr\\$Config{'Ref'}"; rename $source, $target or die "Couldn't move '$source' to '$target' : $!";
      It's giving permission denied on the 'rename' bit. What accesses levels do I need to give to what?

      This is the error:

      Software error: Couldn't move '\\ybslint01\wwwdev\streams\5110\1144336035.htm' to '\\y +bslint01\wwwybs\ybsone\pipeline\master\13Apr\1144336035.htm' : Permis +sion denied at E:\Perlcgi\Pipeline\approve.pl line 189.
        Are you sure that you have share level and NTFS permissions on $sharename1 and $sharename2? That's probably where the error is. You might have to check with an Admin to ensure that the user running the script has the appropriate access to browse to the UNC (Windows browsing through Explorer, not browsing with IE, they are two different animals).