source: issm/trunk-jpl/src/m/utils/OS/issmscpout.m@ 12743

Last change on this file since 12743 was 12743, checked in by jschierm, 13 years ago

Preliminary python versions of issmssh, issmscpin, and issmscpout (in preparation for class generic).

File size: 1.4 KB
Line 
1function issmscpout(host,path,login,port,packages)
2%SCPOUT send packages to a host, using scp on unix, and pscp on windows
3%
4% usage: scpout(host,path,packages)
5%
6%
7
8%get hostname
9hostname=oshostname();
10
11%if hostname and host are the same, do a simple copy
12
13if strcmpi(host,hostname),
14 for i=1:numel(packages),
15 here=pwd;
16 eval(['cd ' path])
17 system(['rm -rf ' packages{i} ]);
18 system(['ln -s ' here '/' packages{i} ' .']);
19 eval(['cd ' here]);
20 end
21else
22 if ispc,
23 %use the putty project pscp.exe: it should be in the path.
24
25 %get ISSM_DIR variable
26 [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]');
27 if status,
28 error('scpout error message: could not find ISSM_DIR_WIN environment variable');
29 end
30 ISSM_DIR=ISSM_DIR(2:end-2);
31
32 username=input('Username: (quoted string) ');
33 key=input('Key: (quoted string) ');
34
35 for i=1:numel(packages),
36 [status,result]=system([ISSM_DIR '/externalpackages/ssh/pscp.exe -l "' username '" -pw "' key '" ' packages{i} ' ' host ':' path]);
37 if status,
38 error('scpout error message: could not call putty pscp');
39 end
40 end
41
42 else
43 %just use standard unix scp
44 %create string of packages being sent
45 string='';
46 for i=1:numel(packages),
47 string=[string ' ' packages{i}];
48 end
49 string=[string ' '];
50
51 if port,
52 eval(['!scp -P ' num2str(port) ' ' string ' ' login '@localhost:' path]);
53 else
54 eval(['!scp ' string ' ' login '@' host ':' path]);
55 end
56 end
57end
Note: See TracBrowser for help on using the repository browser.