function issmscpout(host,path,login,port,packages) %SCPOUT send packages to a host, using scp on unix, and pscp on windows % % usage: scpout(host,path,packages) % % %get hostname hostname=oshostname(); %if hostname and host are the same, do a simple copy if strcmpi(host,hostname), for i=1:numel(packages), here=pwd; eval(['cd ' path]) system(['rm -rf ' packages{i} ]); system(['ln -s ' here '/' packages{i} ' .']); eval(['cd ' here]); end else if ispc, %use the putty project pscp.exe: it should be in the path. %get ISSM_TIER variable [status,ISSM_TIER]=system('echo [%ISSM_TIER_WIN%]'); if status, error('scpout error message: could not find ISSM_TIER_WIN envirnoment variable'); end ISSM_TIER=ISSM_TIER(2:end-2); username=input('Username: (quoted string) '); key=input('Key: (quoted string) '); for i=1:numel(packages), [status,result]=system([ISSM_TIER '/externalpackages/ssh/pscp.exe -l "' username '" -pw "' key '" ' packages{i} ' ' host ':' path]); if status, error('scpout error message: could not call putty pscp'); end end else %just use standard unix scp %create string of packages being sent string=''; for i=1:numel(packages), string=[string ' ' packages{i}]; end string=[string ' ']; if port, eval(['!scp -P ' num2str(port) ' ' string ' ' login '@localhost:' path]); else eval(['!scp ' string ' ' login '@' host ':' path]); end end end