Sponsored Content
Top Forums Shell Programming and Scripting Using Perl to explore recursively remote windows path from AIX Post 302934995 by Fundix on Thursday 12th of February 2015 08:27:58 AM
Old 02-12-2015
Hello RavinderSingh13,

Quote:
Originally Posted by RavinderSingh13
Just want to let you know if we have a Shared storage at Windows level, we can make that storage available too in UNIX in form of NFS etc.
Please do check with your storage team if this is possible, it may help you and can save your time and effort to manually/automatically copying the data from one system to another.
Windows admins create a d:\temp share on my comp server.
I used the following code :

Code:
#!/usr/bin/perl -w

use strict;
use Net::SFTP::Foreign;

my $host="comp";
my $user="john";
my $dir="d:/temp/*"

# Command KO, do not work
print "Test SFTP\n";
my $sftp = Net::SFTP::Foreign->new("$user\@$host");
my @files = $sftp->glob("$dir", names_only => 1);

foreach my $l (@files) {
  print "$l\n";
}

# commande OK, works
print "Test LS\n";
my @files2=`ssh $user\@$host 'ls -R $dir'`;

foreach my $l (@files2) {
  print "$l";
}

The LS test works fine and i got the following output :
Code:
Test SFTP
Test LS
d:/temp/3407_2.prt
d:/temp/4656_1.prt
d:/temp/4656_2.prt
d:/temp/4718_1.prt
d:/temp/4718_2.prt
d:/temp/SuHOST.bat
d:/temp/agtepo45.log
d:/temp/debug.txt
d:/temp/droits.bat
d:/temp/icone.bat
d:/temp/iconebis.bat
d:/temp/iconeged.bat
d:/temp/lo_config_printer.txt
d:/temp/lo_default_printer.txt
d:/temp/ora.bat
d:/temp/sqlnet.ora
d:/temp/supappli.bat
d:/temp/tnsnames.ora

d:/temp/dir1:
3407_2.bat
4656_1.prt
4656_2.prt
4718_1.prt
4718_2.prt
dir2

d:/temp/dir1/dir2:
jboss.log

I found there that I must use Net::SSH2, but that module can't be installed on my Aix.

If the LS solution works i will create extra code to filter my list but i regret i can't use Net::SFTP::Foreign module on Windows.

Maybe there another solution/module which will works fine to retrieve remote Windows/UNIX file lists.

Thank You
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP command to search recursively in windows folder

Hi what command to be used to FTP files from the windows directory into a folder in unix environment using shell script The script should be able to recursively search into 100 subdirectories within my windows directory for .xml files. Can anyone help me with this... thnx (6 Replies)
Discussion started by: lakshmis10
6 Replies

2. UNIX for Dummies Questions & Answers

Need help configuring Active Perl on Windows Vista.: Perl Scripting on Windows

Hi All, Need help configuring Active Perl on Windows Vista. I am trying to install Active Perl on Windows Vista. The version of Active Perl i am trying to install is : ActivePerl 5.10.1 Build 1006 After installing it through cmd, When i try to run perl -v to check the version, i get the... (2 Replies)
Discussion started by: Vabiosis
2 Replies

3. Shell Programming and Scripting

Execution difference in perl scripts for windows / AIX

Hi, I have perl script abc.pl which runs perfectly fine on windows ( execution from cmd). Now i tried to execute the same perl module on the AIX server after defining the captureoutput.pm and other relevant changes. But its behaving very weirdly as a portion of the URL which is formed by... (3 Replies)
Discussion started by: slayer0611
3 Replies

4. Shell Programming and Scripting

shellscript on AIX to download file from windows to AIX

i require the shell script that is running on the AIX to download a file from Windows desktop to the location where the shell script resides onthe AIX system. I have used the below code: but it throwing the error as below.please help me at the earliest to resolve the issue. error message :... (1 Reply)
Discussion started by: kvkc
1 Replies

5. Shell Programming and Scripting

Library on Remote machine or $PATH is not working..

I don't know how to put this. However here is the problem. While executing command remotely on a Unix machine i get an error /usr/lib/hpux32/dld.so: Unable to find library 'libxerces-c.sl.21'. However when i execute the command on the remote machine locally. it works fine. Also i have... (2 Replies)
Discussion started by: suraj.sheikh
2 Replies

6. UNIX for Dummies Questions & Answers

echo windows path

I have developed a script that transfers files from a UNIX machine to a Windows machine. Transferring the files is working perfectly, but my echo statements are displaying the destination (Windows) path names incorrectly. I understand that it is the "\" that is causing this, but is there anyway... (5 Replies)
Discussion started by: shammah77
5 Replies

7. AIX

How to set up remote X Windows on AIX ?

Hi, I want to display a program on my local workstation, that is running on a remote AIX, and I have done the following: install an X server (Xming) on my windows machine enable X11 forwarding in Putty enable X11 forwarding for the SSH daemon restart SSH daemon text X... (9 Replies)
Discussion started by: SteAlma
9 Replies

8. UNIX for Advanced & Expert Users

DOS/VB script of Remote Windows Server from AIX

Hi We use to run DOS and VB script in Windows Server . Now the requirement is to trigger the same script from AIX server by shell script , thus it would be executed in Remote Windows Server . Is it possible ( though SSH or any other way ) ? Thanks (2 Replies)
Discussion started by: Sourajit Seth
2 Replies

9. Shell Programming and Scripting

[Perl] Module for recursive listing of remote Windows shares

Hi, I'm looking for a Perl module which can recursively list remote Windows shares from within a Linux machine. I've tried Filesys::SmbClient ans Filesys:SmbClientPars but they just list the current directory Thank You for your help (4 Replies)
Discussion started by: Fundix
4 Replies

10. AIX

Samba 3.6 on AIX 7.1 - Windows 10 Access to AIX file shares using Active Directory authentication

I am running AIX 7.1 and currently we have samba 3.6.25 installed on the server. As it stands some AIX folders are shared that can be accessed by certain Windows users. The problem is that since Windows 10 the guest feature no longer works so users have to manually type in their Windows login/pwd... (14 Replies)
Discussion started by: linuxsnake
14 Replies
Net::SFTP::Foreign::Compat(3pm) 			User Contributed Perl Documentation			   Net::SFTP::Foreign::Compat(3pm)

NAME
Net::SFTP::Foreign::Compat - Adaptor for Net::SFTP compatibility SYNOPSIS
use Net::SFTP::Foreign::Compat; my $sftp = Net::SFTP::Foreign::Compat->new($host); $sftp->get("foo", "bar"); $sftp->put("bar", "baz"); use Net::SFTP::Foreign::Compat ':supplant'; my $sftp = Net::SFTP->new($host); DESCRIPTION
This package is a wrapper around Net::SFTP::Foreign that provides an API (mostly) compatible with that of Net::SFTP. Methods on this package are identical to those in Net::SFTP except that Net::SFTP::Foreign::Attributes::Compat objects have to be used instead of Net::SFTP::Attributes. If the ":supplant" tag is used, this module installs also wrappers on the "Net::SFTP" and Net::SFTP::Attributes packages so no other parts of the program have to modified in order to move from Net::SFTP to Net::SFTP::Foreign. Setting defaults The hash %Net::SFTP::Foreign::DEFAULTS can be used to set default values for Net::SFTP::Foreign methods called under the hood and otherwise not accesible through the Net::SFTP API. The entries currently supported are: new => @opts extra options passed to Net::SFTP::Foreign constructor. get => @opts extra options passed to Net::SFTP::Foreign::get method. put => @opts extra options passed to Net::SFTP::Foreign::put method. ls => @opts extra options passed to Net::SFTP::Foreign::ls method. COPYRIGHT
Copyright (c) 2006-2008, 2011 Salvador Fandin~o All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-05-04 Net::SFTP::Foreign::Compat(3pm)
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy