From: Aiman H. <ha...@gm...> - 2007-03-15 19:18:36
|
Hi, I'm new to this Expect. Just found out and decided to use in my current project assignment. Really appreciate any help. I've trying to look somewhere else (unsuccessfully) before decided to post it here. I want to use expect to do sftp. After login, I'll get the list of available files in the directory, and from the list, I'll need to do some matching with localhost list to get the file that is not in the local host. I trying to do something like this: ....... ........ my $ret = $exp->expect(30,"sftp>") || die "Timeout waiting for sftp.\n"; $exp->send("cd /tmp\n"); $exp->expect(10,"sftp>"); my @file=$exp->send("ls A*\n"); foreach $file (@file) { #do comparison # if not match, $exp->send("get $file\n"); } ..... .... Line "my @file=$exp->send("ls A*\n");" does;t give me the file list that I want. I can do like this using Net::FTP, but not using Expect. Is there any way to achieve this? Again, any help or sample or other workaround/suggestion is very much appreciated. br///Hakime |