Advertisement

08.04.2006 at 01:57PM PDT, ID: 21944047
[x]
Attachment Details

$ftp->cwd() issue

Asked by shakir77 in Perl Programming Language

Tags: ftp, label, syntax

Experts,

I'm having problem in FTP during the "cwd" command.
Error msg i'm getting "The filename, directory name, or volume label syntax is incorrect"

What actuallly i'n trying to do is FTP file from unix to window.
Default directory (C:\BoxiEvents) is set at Windows FTP server

if i omit cwd command , FTP works and places test_event file in default location.
but it fails when i try FTP on specific directoty under BoxiEvents folder(like metioned below )

Would appreciate if anybody has any idea on how can i resolve this .

Regards
Shakir

Code
-----------------------------------------------------------------
my $eventFileName      = 'test_event';
my $dir='C:\\BoxiEvents\\ER';

#server, user and password are all defined
#FTP server is installed on windows 2000

               # Set the server to log on to
      my $ftp = Net::FTP->new($server,Debug=>1) || die "ERROR connecting to FTP server: $@\n";
      
      # Login
      $ftp->login($user,$pswd) || die "ERROR couldn't login.Please check the crendentials\n";
      
      # Change to destination directory
      if ($dir){
            $ftp->cwd("$dir") || die "ERROR couldn't change directory '$dir' ", $ftp->message;
      }

      # Set file transfer type to binary
      $ftp->binary();
      
      my $ftpFile ='/tmp/'.$eventFileName ;
      open (FILE,">$ftpFile");
      close FILE;

      # Transfer the file
      $ftp->put($ftpFile) || die "ERROR: Could not transfer file to server: $@\n";
      $ftp->quit();Start Free Trial
 
 
[+][-]08.04.2006 at 02:06PM PDT, ID: 17253178

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.04.2006 at 02:10PM PDT, ID: 17253197

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.04.2006 at 05:09PM PDT, ID: 17253939

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: ftp, label, syntax
Sign Up Now!
Solution Provided By: clockwatcher
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.07.2006 at 09:31AM PDT, ID: 17265022

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32