RE: FW: suggestion for sftp process

2006-03-15 Thread Curt Shaffer


-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 14, 2006 11:48 AM
To: Curt Shaffer
Cc: beginners@perl.org
Subject: Re: FW: suggestion for sftp process

On 3/14/06, Curt Shaffer [EMAIL PROTECTED] wrote:
 I have a small update to this post. I found out that I will be able to get
 all of the files in the remote directory. Unfortunately I do not see a way
 to do this with Net::SFTP. There is no mget function and * does not seem
to
 work for the file name.
 Thanks
 Curt
snip

Just loop over the files in the directory.

for my $file (map { $_-{filename} } $sftp-ls('/path') {
$sftp-get(/path/$file);
}

This is what I have now:

my @files = $sftp-ls($remotedir);
foreach (@files){
$sftp-get($_);
print recieving $_...\n;
}
print Complete!\n;

but what I get for each loop in debug is the following:

linuxbox: sftp: Sent message T:17 I:30
linuxbox sftp: Received stat reply T:101 I:30
Couldn't stat remote file: No such file or directory at ./sftptest line 24
recieving HASH(0x9dbb0ac)...

of course the HASH is different for each loop.

Any ideas?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: FW: suggestion for sftp process

2006-03-14 Thread Chas Owens
On 3/14/06, Curt Shaffer [EMAIL PROTECTED] wrote:
 I have a small update to this post. I found out that I will be able to get
 all of the files in the remote directory. Unfortunately I do not see a way
 to do this with Net::SFTP. There is no mget function and * does not seem to
 work for the file name.
 Thanks
 Curt
snip

Just loop over the files in the directory.

for my $file (map { $_-{filename} } $sftp-ls('/path') {
$sftp-get(/path/$file);
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: FW: suggestion for sftp process

2006-03-14 Thread Curt Shaffer

-Original Message-
From: KyLiE [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 14, 2006 10:36 AM
To: Curt Shaffer
Subject: Re: FW: suggestion for sftp process

Curt Shaffer wrote:

I have a small update to this post. I found out that I will be able to get
all of the files in the remote directory. Unfortunately I do not see a way
to do this with Net::SFTP. There is no mget function and * does not seem to
work for the file name.

 

Thanks

 

Curt

 

  _  

From: Curt Shaffer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 14, 2006 9:45 AM
To: beginners@perl.org
Subject: suggestion for sftp process

 

I am writing a process that will need to establish a SFTP connection with a
remote server, pull a file down and copy it to an archive and system
folder.
I also have to do the opposite where I will need to get a file from a
system
directory and push it via SFTP to a remote server. Now I have the push part
of this working fine. I just look for a matching regex of the filename and
put it where it needs to go. The issue I have is that the file name will
change every time just a little (i.e. has a date stamp and index) so where
regex works locally, I am lost at how to expect the date stamp and index
from the remote file. 

 

Any help will be appreciated.

 

Curt

 

 

 


  

Exactly, unfortunately Net::SFTP dont have support for * or any other 
comodin, I try it before,what I do and suggest to you is to create an 
XML with all the entries and exits that you want to do (files, 
directories, etc) you can create your own module that, with LibXML, 
create a DOM tree and send orput your files with Net::SFTP


It appears that Net::SFTP::Recursive might hold what I am looking for. It
has a file_pat option that will match patterns unless I am reading too much
into it. I am trying it out now. I will post the outcome.

Thanks

Curt


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response