CD Change or get current working directory on an SFTP server. Syntax: CD(H, PATH) PWD = CD(H, PATH) PWD = CD(H) Description: CD(H, PATH) changes the current working directory to the one specified. PWD = CD(H, PATH) changes the working directory and returns the new one. PWD = CD(H) returns the current working directory. Examples: % Get current directory: old_dir = cd(h) % Move up one directory and get new current directory: new_dir = cd(h, '..'): % Go back to previous directory: cd(old_dir) See also: SFTP Authors: Joan Pau Beltran <joanpau.beltran@socib.cat>
0001 function pwd = cd(h, path) 0002 %CD Change or get current working directory on an SFTP server. 0003 % 0004 % Syntax: 0005 % CD(H, PATH) 0006 % PWD = CD(H, PATH) 0007 % PWD = CD(H) 0008 % 0009 % Description: 0010 % CD(H, PATH) changes the current working directory to the one specified. 0011 % 0012 % PWD = CD(H, PATH) changes the working directory and returns the new one. 0013 % 0014 % PWD = CD(H) returns the current working directory. 0015 % 0016 % Examples: 0017 % % Get current directory: 0018 % old_dir = cd(h) 0019 % % Move up one directory and get new current directory: 0020 % new_dir = cd(h, '..'): 0021 % % Go back to previous directory: 0022 % cd(old_dir) 0023 % 0024 % See also: 0025 % SFTP 0026 % 0027 % Authors: 0028 % Joan Pau Beltran <joanpau.beltran@socib.cat> 0029 0030 % Copyright (C) 2014-2016 0031 % ICTS SOCIB - Servei d'observacio i prediccio costaner de les Illes Balears 0032 % <http://www.socib.es> 0033 % 0034 % This program is free software: you can redistribute it and/or modify 0035 % it under the terms of the GNU General Public License as published by 0036 % the Free Software Foundation, either version 3 of the License, or 0037 % (at your option) any later version. 0038 % 0039 % This program is distributed in the hope that it will be useful, 0040 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0041 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0042 % GNU General Public License for more details. 0043 % 0044 % You should have received a copy of the GNU General Public License 0045 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0046 0047 if (nargin > 1) 0048 mexsftp('cwd', h.sftp_handle, path); 0049 end 0050 pwd = mexsftp('pwd', h.sftp_handle);