Hi there,
Thank you kindly for your response. I ran the code again the ftp
process ran flawlessly until the put statement when the error came
back:
File dms_nspwr_2005_08_02_1404.txt does not exist!
The file is in the same directory as the script and contains data. I
even tried putting in sleep 10 in case it was necessary to give the
server time to save the file but to no avail.
Chris
P.S. I tired explictly defining all my variables but ran into one
problem with one used for my e-mail routine $mail. The line in
question is:
$mail{From} = 'Data Upload <>';
Here's the error it gave me.
Global symbol "%mail" requires explicit package name at line 147.
Paul Lalli wrote:
> Nex_s wrote:
> > I'm trying to format a date and store it in a variable for a file
> > name. The file gets created but for some reason my FTP process sends
> > an empty file with the same name.
> >
> > Any help would be greatly appreciated.
>
> > Here's how I'm formatting the date.
> >
> > $file = "dms_nspwr_" . `date +%b_%d_%y_%H%M.txt`;
>
> There's little need to shell this out to an external command. Check
> out the strftime() function in
> perldoc POSIX
>
> > Here's my FTP code:
> >
> > $ftp = Net::FTP ->new("123.456.789.10", Debug => 0)
>
> You appear to not be using strict. Please make sure all your scripts
> that you ask for help with here start with
> use strict;
> use warnings;
>
> Also, as you seem to be having problems with the FTP class, perhaps it
> would be a good idea to enable debugging, to ensure that your program
> is doing what you think it's doing? Try replacing the end of that
> constructor with:
> Debug => 1)
>
> > or die "Cannot connect to some.host.name: $@";
> >
> > $ftp->login("username",'password')
> > or die "Cannot login ", $ftp->message;
> >
> > #$ftp->cwd("/pub")
> > # or die "Cannot change working directory ", $ftp->message;
> >
> >
> > $ftp->put("$file")
>
> This is a useless use of double quotes, and is a bad habbit to get
> into. Please read:
> perldoc -q quoting
>
> > or die "put failed $file", $ftp->message;
> >
> > $ftp->quit;
>
> Have you verified that the file exists in the current local directory?
> Have you verified that the file has content in the current local
> directory?
>
> Try adding these two lines before the $ftp->put():
>
> -e $file or die "File $file does not exist!\n"
> -s _ or die "File $file is empty!\n";
>
> and let us know the results of those lines plus the Debugging output...
>
> Paul Lalli
|