Pragma Systems Technical Forum

Recursive Directory Transfer from Between Servers?

https://forums.pragmasys.com/Topic132.aspx

By tlockhart - 1/25/2012 7:38:28 AM

Is it possible in FortressSSH Enterprise  Version 5.0 to transfer directories between servers?  This is similar to the way mget and mput can transfer files, but I need to transfer a whole directory structure, including files.  Any assistance would be greatly appreciated.
By Ken - 1/25/2012 11:34:15 AM

Yes, it can be done with the built in scp server and scp client.

Use the scp command with -r recursive directiory copying feature and -p for keeping original date&time.

E.g.

scp -pr remotemachine:c:/srcdirectory .

// this will copy remotemachine's c:/srcdirectory and all its subdirectories and files to the current directory

// from where this command is issued. -p keeps the original files time and date.

scp -pr ken@remotemachine:mydir newdir

// thiis will login as ken and copy "mydir" from the homedirectory to "newdir"
By tlockhart - 1/27/2012 2:37:22 AM

Thanks Ken!

Is there a way to delete the directory from the remote server, after it has been transfered to the local server (NOTE: The directories will contain files and other directories)? I don't believe deltree will work for this task.  Do you have any suggestions?
By Pragma Tech Rep - 1/27/2012 4:10:40 AM

yes, use ssh shell command access and deltree -F in Windows hosts and "rm -rf" command to Linix/unix hosts.

ssh id@remotehost deltree -F dirtodelete      ; for Windows hosts

ssh id@remotehost rm -rf dirtodelete            ; for Linux/Unix hosts
By tlockhart - 2/7/2012 5:19:28 AM

That worked, but since this is a batch job.  I need the ability to login to SSH with userid and password.  Is there a way to login with the userid and password, and avoid the pasword prompt?
By Technical Support Group (TSG) - 2/7/2012 5:37:03 AM

Try the following:

ssh -l username -A password remotehost

 

Thank you,

Technical Support Group (TSG)
Pragma Systems, Inc.
By tlockhart - 2/7/2012 6:50:57 AM

I tried the following at the command line, and it worked, but it does not work in my test script(see below).

%SSHPATH%\ssh.exe -A password username@255.255.255.255

cd C:
cd C:\sample_data
deltree -F TEST
mkdir TEST

I don't believe my script is waiting until after I login to the SSH Session before it continues execution.  I am receiving the following error, before the ssh session opens.  Can anyone advise?

008:ERROR: %SSHPATH%\ssh.exe deltree -F is an unsupported command
By Pragma Tech Rep - 2/7/2012 7:08:37 AM

try this as deltree is in the same directory where ssh.exe is located:

%SSHPATH%\deltree -F TEST

or more fully

%SSHPATH%\ssh.exe -A password username@255.255.255.255 "\program files\pragma\clients\deltree -F TEST"

You should also try to put "\program files\pragma\clients"n directory in the system environment "path"  variable. deltree.exe and ssh.exe are all copied there during install of our software.