How to chdir using SFTP or SSH on Win32

[email protected] ("Sturdevant, Robert W Mr CTR USA AMC")
Newsgroups perl.beginners
Message-ID <A118FD79469A094A81E1DC046D2CC95B0E28FA@leee010belpc104.nae.ds.army.mil>
Hi list,

I asked this question a few days ago on the perl-win32-users list but still
need some help. It seems what I need may not be possible.

I have a perl (5.6) SFTP client (Net::SFTP) that gets and puts files using
either a full or relative path with the filename something like this:

$sftp->get( $remotename, $localname ); # where $remotename =
'/Home/OUT/myfile.txt'

But I have a remote system with a custom server app that rejects the path
and requires a chdir to the correct file location. To fetch a file I need to
do something like this:

$sftp->chdir( $path );   #cd to the OUT folder
$sftp->get( $shortname, $localname);   # get the file using only the file
name

I see no way to do $sftp->chdir. Please advise if something similar is
possible. I have tried many combinations of commands using SSH such as
$ssh->cmd( 'cd $path' ) with no joy. $ssh->cmd() always seems to hang. TIA.

Sturdy
smime.p7s (application/x-pkcs7-signature, 4.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.