<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>paramiko.SFTPClient</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="paramiko-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="paramiko-module.html">Package paramiko</a> :: Class SFTPClient </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="paramiko.SFTPClient-class.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class SFTPClient</h1><p class="nomargin-top"><span class="codelink"><a href="paramiko-pysrc.html#SFTPClient">source code</a></span></p> <pre class="base-tree"> object --+ | BaseSFTP --+ | <strong class="uidshort">SFTPClient</strong> </pre> <dl><dt>Known Subclasses:</dt> <dd> <ul class="subclass-list"> <li><a href="paramiko.SFTP-class.html">SFTP</a></li> </ul> </dd></dl> <hr /> <p>SFTP client object. <code>SFTPClient</code> is used to open an sftp session across an open ssh <a href="paramiko.Transport-class.html" class="link">Transport</a> and do remote file operations.</p> <!-- ==================== INSTANCE METHODS ==================== --> <a name="section-InstanceMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">sock</span>)</span><br /> Create an SFTP client from an existing <a href="paramiko.Channel-class.html" class="link">Channel</a>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#chdir" class="summary-sig-name">chdir</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Change the "current directory" of this SFTP session.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#chmod" class="summary-sig-name">chmod</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>, <span class="summary-sig-arg">mode</span>)</span><br /> Change the mode (permissions) of a file.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#chown" class="summary-sig-name">chown</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>, <span class="summary-sig-arg">uid</span>, <span class="summary-sig-arg">gid</span>)</span><br /> Change the owner (<code>uid</code>) and group (<code>gid</code>) of a file.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#close" class="summary-sig-name">close</a>(<span class="summary-sig-arg">self</span>)</span><br /> Close the SFTP session and its underlying channel.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">SFTPFile</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#file" class="summary-sig-name">file</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">filename</span>, <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>, <span class="summary-sig-arg">bufsize</span>=<span class="summary-sig-default">-1</span>)</span><br /> Open a file on the remote server.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#get" class="summary-sig-name">get</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">remotepath</span>, <span class="summary-sig-arg">localpath</span>, <span class="summary-sig-arg">callback</span>=<span class="summary-sig-default">None</span>)</span><br /> Copy a remote file (<code>remotepath</code>) from the SFTP server to the local host as <code>localpath</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.Channel-class.html" class="link">Channel</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#get_channel" class="summary-sig-name">get_channel</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the underlying <a href="paramiko.Channel-class.html" class="link">Channel</a> object for this SFTP session.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">str</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#getcwd" class="summary-sig-name">getcwd</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the "current working directory" for this SFTP session, as emulated by paramiko.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">list of str</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#listdir" class="summary-sig-name">listdir</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">.</code><code class="variable-quote">'</code></span>)</span><br /> Return a list containing the names of the entries in the given <code>path</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">list of <a href="paramiko.SFTPAttributes-class.html" class="link">SFTPAttributes</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#listdir_attr" class="summary-sig-name">listdir_attr</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">.</code><code class="variable-quote">'</code></span>)</span><br /> Return a list containing <a href="paramiko.SFTPAttributes-class.html" class="link">SFTPAttributes</a> objects corresponding to files in the given <code>path</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">SFTPAttributes</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#lstat" class="summary-sig-name">lstat</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Retrieve information about a file on the remote system, without following symbolic links (shortcuts).</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#mkdir" class="summary-sig-name">mkdir</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>, <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default">511</span>)</span><br /> Create a folder (directory) named <code>path</code> with numeric mode <code>mode</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">str</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#normalize" class="summary-sig-name">normalize</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Return the normalized path (on the server) of a given path.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">SFTPFile</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#open" class="summary-sig-name">open</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">filename</span>, <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>, <span class="summary-sig-arg">bufsize</span>=<span class="summary-sig-default">-1</span>)</span><br /> Open a file on the remote server.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">SFTPAttributes</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#put" class="summary-sig-name">put</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">localpath</span>, <span class="summary-sig-arg">remotepath</span>, <span class="summary-sig-arg">callback</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">confirm</span>=<span class="summary-sig-default">True</span>)</span><br /> Copy a local file (<code>localpath</code>) to the SFTP server as <code>remotepath</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">str</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#readlink" class="summary-sig-name">readlink</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Return the target of a symbolic link (shortcut).</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#remove" class="summary-sig-name">remove</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Remove the file at the given path.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#rename" class="summary-sig-name">rename</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">oldpath</span>, <span class="summary-sig-arg">newpath</span>)</span><br /> Rename a file or folder from <code>oldpath</code> to <code>newpath</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#rmdir" class="summary-sig-name">rmdir</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Remove the folder named <code>path</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">SFTPAttributes</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#stat" class="summary-sig-name">stat</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Retrieve information about a file on the remote system.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#symlink" class="summary-sig-name">symlink</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">source</span>, <span class="summary-sig-arg">dest</span>)</span><br /> Create a symbolic link (shortcut) of the <code>source</code> path at <code>destination</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#truncate" class="summary-sig-name">truncate</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>, <span class="summary-sig-arg">size</span>)</span><br /> Change the size of the file specified by <code>path</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#unlink" class="summary-sig-name">unlink</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>)</span><br /> Remove the file at the given path.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#utime" class="summary-sig-name">utime</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">path</span>, <span class="summary-sig-arg">times</span>)</span><br /> Set the access and modified times of the file specified by <code>path</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__delattr__</code>, <code>__format__</code>, <code>__getattribute__</code>, <code>__hash__</code>, <code>__new__</code>, <code>__reduce__</code>, <code>__reduce_ex__</code>, <code>__repr__</code>, <code>__setattr__</code>, <code>__sizeof__</code>, <code>__str__</code>, <code>__subclasshook__</code> </p> </td> </tr> </table> <!-- ==================== CLASS METHODS ==================== --> <a name="section-ClassMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Class Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="paramiko.SFTPClient-class.html" class="link">SFTPClient</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#from_transport" class="summary-sig-name">from_transport</a>(<span class="summary-sig-arg">cls</span>, <span class="summary-sig-arg">t</span>)</span><br /> Create an SFTP client channel from an open <a href="paramiko.Transport-class.html" class="link">Transport</a>.</td> <td align="right" valign="top"> <span class="codelink"><a href="paramiko-pysrc.html#SFTPClient.from_transport">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== PROPERTIES ==================== --> <a name="section-Properties"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Properties</span></td> </tr> <tr> <td colspan="2" class="summary"> <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: <code>__class__</code> </p> </td> </tr> </table> <!-- ==================== METHOD DETAILS ==================== --> <a name="section-MethodDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Method Details</span></td> </tr> </table> <a name="__init__"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, <span class="sig-arg">sock</span>)</span> <br /><em class="fname">(Constructor)</em> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Create an SFTP client from an existing <a href="paramiko.Channel-class.html" class="link">Channel</a>. The channel should already have requested the <code>"sftp"</code> subsystem.</p> <p>An alternate way to create an SFTP client context is by using <a href="paramiko.SFTPClient-class.html#from_transport" class="link">from_transport</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>sock</code></strong> (<a href="paramiko.Channel-class.html" class="link">Channel</a>) - an open <a href="paramiko.Channel-class.html" class="link">Channel</a> using the <code>"sftp"</code> subsystem</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'><a href="paramiko.SSHException-class.html">SSHException</a></strong></code> - if there's an exception while negotiating sftp</li> </ul></dd> <dt>Overrides: object.__init__ </dt> </dl> </td></tr></table> </div> <a name="chdir"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">chdir</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Change the "current directory" of this SFTP session. Since SFTP doesn't really have the concept of a current working directory, this is emulated by paramiko. Once you use this method to set a working directory, all operations on this SFTPClient object will be relative to that path. You can pass in <code>None</code> to stop using a current working directory.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - new current working directory</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if the requested path doesn't exist on the server</li> </ul></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.4 </p> </div></td></tr></table> </div> <a name="chmod"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">chmod</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>, <span class="sig-arg">mode</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Change the mode (permissions) of a file. The permissions are unix-style and identical to those used by python's <code>os.chmod</code> function.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path of the file to change the permissions of</li> <li><strong class="pname"><code>mode</code></strong> (int) - new permissions</li> </ul></dd> </dl> </td></tr></table> </div> <a name="chown"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">chown</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>, <span class="sig-arg">uid</span>, <span class="sig-arg">gid</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Change the owner (<code>uid</code>) and group (<code>gid</code>) of a file. As with python's <code>os.chown</code> function, you must pass both arguments, so if you only want to change one, use <a href="paramiko.SFTPClient-class.html#stat" class="link">stat</a> first to retrieve the current owner and group.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path of the file to change the owner and group of</li> <li><strong class="pname"><code>uid</code></strong> (int) - new owner's uid</li> <li><strong class="pname"><code>gid</code></strong> (int) - new group id</li> </ul></dd> </dl> </td></tr></table> </div> <a name="close"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">close</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Close the SFTP session and its underlying channel.</p> <dl class="fields"> </dl> <div class="fields"> <p><strong>Since:</strong> 1.4 </p> </div></td></tr></table> </div> <a name="file"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">file</span>(<span class="sig-arg">self</span>, <span class="sig-arg">filename</span>, <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>, <span class="sig-arg">bufsize</span>=<span class="sig-default">-1</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Open a file on the remote server. The arguments are the same as for python's built-in <code>file</code> (aka <code>open</code>). A file-like object is returned, which closely mimics the behavior of a normal python file object.</p> <p>The mode indicates how the file is to be opened: <code>'r'</code> for reading, <code>'w'</code> for writing (truncating an existing file), <code>'a'</code> for appending, <code>'r+'</code> for reading/writing, <code>'w+'</code> for reading/writing (truncating an existing file), <code>'a+'</code> for reading/appending. The python <code>'b'</code> flag is ignored, since SSH treats all files as binary. The <code>'U'</code> flag is supported in a compatible way.</p> <p>Since 1.5.2, an <code>'x'</code> flag indicates that the operation should only succeed if the file was created and did not previously exist. This has no direct mapping to python's file flags, but is commonly known as the <code>O_EXCL</code> flag in posix.</p> <p>The file will be buffered in standard python style by default, but can be altered with the <code>bufsize</code> parameter. <code>0</code> turns off buffering, <code>1</code> uses line buffering, and any number greater than 1 (<code>>1</code>) uses that specific buffer size.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>filename</code></strong> (str) - name of the file to open</li> <li><strong class="pname"><code>mode</code></strong> (str) - mode (python-style) to open in</li> <li><strong class="pname"><code>bufsize</code></strong> (int) - desired buffering (-1 = default buffer size)</li> </ul></dd> <dt>Returns: SFTPFile</dt> <dd>a file object representing the open file</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if the file could not be opened.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="from_transport"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">from_transport</span>(<span class="sig-arg">cls</span>, <span class="sig-arg">t</span>)</span> <br /><em class="fname">Class Method</em> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko-pysrc.html#SFTPClient.from_transport">source code</a></span> </td> </tr></table> <p>Create an SFTP client channel from an open <a href="paramiko.Transport-class.html" class="link">Transport</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>t</code></strong> (<a href="paramiko.Transport-class.html" class="link">Transport</a>) - an open <a href="paramiko.Transport-class.html" class="link">Transport</a> which is already authenticated</li> </ul></dd> <dt>Returns: <a href="paramiko.SFTPClient-class.html" class="link">SFTPClient</a></dt> <dd>a new <a href="paramiko.SFTPClient-class.html" class="link">SFTPClient</a> object, referring to an sftp session (channel) across the transport</dd> </dl> </td></tr></table> </div> <a name="get"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get</span>(<span class="sig-arg">self</span>, <span class="sig-arg">remotepath</span>, <span class="sig-arg">localpath</span>, <span class="sig-arg">callback</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Copy a remote file (<code>remotepath</code>) from the SFTP server to the local host as <code>localpath</code>. Any exception raised by operations will be passed through. This method is primarily provided as a convenience.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>remotepath</code></strong> (str) - the remote file to copy</li> <li><strong class="pname"><code>localpath</code></strong> (str) - the destination path on the local host</li> <li><strong class="pname"><code>callback</code></strong> (function(int, int)) - optional callback function that accepts the bytes transferred so far and the total bytes to be transferred (since 1.7.4)</li> </ul></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.4 </p> </div></td></tr></table> </div> <a name="get_channel"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_channel</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the underlying <a href="paramiko.Channel-class.html" class="link">Channel</a> object for this SFTP session. This might be useful for doing things like setting a timeout on the channel.</p> <dl class="fields"> <dt>Returns: <a href="paramiko.Channel-class.html" class="link">Channel</a></dt> <dd>the SSH channel</dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.7.1 </p> </div></td></tr></table> </div> <a name="getcwd"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">getcwd</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the "current working directory" for this SFTP session, as emulated by paramiko. If no directory has been set with <a href="paramiko.SFTPClient-class.html#chdir" class="link">chdir</a>, this method will return <code>None</code>.</p> <dl class="fields"> <dt>Returns: str</dt> <dd>the current working directory on the server, or <code>None</code></dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.4 </p> </div></td></tr></table> </div> <a name="listdir"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">listdir</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">.</code><code class="variable-quote">'</code></span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Return a list containing the names of the entries in the given <code>path</code>. The list is in arbitrary order. It does not include the special entries <code>'.'</code> and <code>'..'</code> even if they are present in the folder. This method is meant to mirror <code>os.listdir</code> as closely as possible. For a list of full <a href="paramiko.SFTPAttributes-class.html" class="link">SFTPAttributes</a> objects, see <a href="paramiko.SFTPClient-class.html#listdir_attr" class="link">listdir_attr</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path to list (defaults to <code>'.'</code>)</li> </ul></dd> <dt>Returns: list of str</dt> <dd>list of filenames</dd> </dl> </td></tr></table> </div> <a name="listdir_attr"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">listdir_attr</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">.</code><code class="variable-quote">'</code></span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Return a list containing <a href="paramiko.SFTPAttributes-class.html" class="link">SFTPAttributes</a> objects corresponding to files in the given <code>path</code>. The list is in arbitrary order. It does not include the special entries <code>'.'</code> and <code>'..'</code> even if they are present in the folder.</p> <p>The returned <a href="paramiko.SFTPAttributes-class.html" class="link">SFTPAttributes</a> objects will each have an additional field: <code>longname</code>, which may contain a formatted string of the file's attributes, in unix format. The content of this string will probably depend on the SFTP server implementation.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path to list (defaults to <code>'.'</code>)</li> </ul></dd> <dt>Returns: list of <a href="paramiko.SFTPAttributes-class.html" class="link">SFTPAttributes</a></dt> <dd>list of attributes</dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.2 </p> </div></td></tr></table> </div> <a name="lstat"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">lstat</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Retrieve information about a file on the remote system, without following symbolic links (shortcuts). This otherwise behaves exactly the same as <a href="paramiko.SFTPClient-class.html#stat" class="link">stat</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - the filename to stat</li> </ul></dd> <dt>Returns: SFTPAttributes</dt> <dd>an object containing attributes about the given file</dd> </dl> </td></tr></table> </div> <a name="mkdir"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">mkdir</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>, <span class="sig-arg">mode</span>=<span class="sig-default">511</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Create a folder (directory) named <code>path</code> with numeric mode <code>mode</code>. The default mode is 0777 (octal). On some systems, mode is ignored. Where it is used, the current umask value is first masked out.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - name of the folder to create</li> <li><strong class="pname"><code>mode</code></strong> (int) - permissions (posix-style) for the newly-created folder</li> </ul></dd> </dl> </td></tr></table> </div> <a name="normalize"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">normalize</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the normalized path (on the server) of a given path. This can be used to quickly resolve symbolic links or determine what the server is considering to be the "current folder" (by passing <code>'.'</code> as <code>path</code>).</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path to be normalized</li> </ul></dd> <dt>Returns: str</dt> <dd>normalized form of the given path</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if the path can't be resolved on the server</li> </ul></dd> </dl> </td></tr></table> </div> <a name="open"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open</span>(<span class="sig-arg">self</span>, <span class="sig-arg">filename</span>, <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">r</code><code class="variable-quote">'</code></span>, <span class="sig-arg">bufsize</span>=<span class="sig-default">-1</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Open a file on the remote server. The arguments are the same as for python's built-in <code>file</code> (aka <code>open</code>). A file-like object is returned, which closely mimics the behavior of a normal python file object.</p> <p>The mode indicates how the file is to be opened: <code>'r'</code> for reading, <code>'w'</code> for writing (truncating an existing file), <code>'a'</code> for appending, <code>'r+'</code> for reading/writing, <code>'w+'</code> for reading/writing (truncating an existing file), <code>'a+'</code> for reading/appending. The python <code>'b'</code> flag is ignored, since SSH treats all files as binary. The <code>'U'</code> flag is supported in a compatible way.</p> <p>Since 1.5.2, an <code>'x'</code> flag indicates that the operation should only succeed if the file was created and did not previously exist. This has no direct mapping to python's file flags, but is commonly known as the <code>O_EXCL</code> flag in posix.</p> <p>The file will be buffered in standard python style by default, but can be altered with the <code>bufsize</code> parameter. <code>0</code> turns off buffering, <code>1</code> uses line buffering, and any number greater than 1 (<code>>1</code>) uses that specific buffer size.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>filename</code></strong> (str) - name of the file to open</li> <li><strong class="pname"><code>mode</code></strong> (str) - mode (python-style) to open in</li> <li><strong class="pname"><code>bufsize</code></strong> (int) - desired buffering (-1 = default buffer size)</li> </ul></dd> <dt>Returns: SFTPFile</dt> <dd>a file object representing the open file</dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if the file could not be opened.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="put"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">put</span>(<span class="sig-arg">self</span>, <span class="sig-arg">localpath</span>, <span class="sig-arg">remotepath</span>, <span class="sig-arg">callback</span>=<span class="sig-default">None</span>, <span class="sig-arg">confirm</span>=<span class="sig-default">True</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Copy a local file (<code>localpath</code>) to the SFTP server as <code>remotepath</code>. Any exception raised by operations will be passed through. This method is primarily provided as a convenience.</p> <p>The SFTP operations use pipelining for speed.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>localpath</code></strong> (str) - the local file to copy</li> <li><strong class="pname"><code>remotepath</code></strong> (str) - the destination path on the SFTP server</li> <li><strong class="pname"><code>callback</code></strong> (function(int, int)) - optional callback function that accepts the bytes transferred so far and the total bytes to be transferred (since 1.7.4)</li> <li><strong class="pname"><code>confirm</code></strong> (bool) - whether to do a stat() on the file afterwards to confirm the file size (since 1.7.7)</li> </ul></dd> <dt>Returns: SFTPAttributes</dt> <dd>an object containing attributes about the given file (since 1.7.4)</dd> </dl> <div class="fields"> <p><strong>Since:</strong> 1.4 </p> </div></td></tr></table> </div> <a name="readlink"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">readlink</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Return the target of a symbolic link (shortcut). You can use <a href="paramiko.SFTPClient-class.html#symlink" class="link">symlink</a> to create these. The result may be either an absolute or relative pathname.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path of the symbolic link file</li> </ul></dd> <dt>Returns: str</dt> <dd>target path</dd> </dl> </td></tr></table> </div> <a name="remove"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">remove</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Remove the file at the given path. This only works on files; for removing folders (directories), use <a href="paramiko.SFTPClient-class.html#rmdir" class="link">rmdir</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path (absolute or relative) of the file to remove</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if the path refers to a folder (directory)</li> </ul></dd> </dl> </td></tr></table> </div> <a name="rename"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">rename</span>(<span class="sig-arg">self</span>, <span class="sig-arg">oldpath</span>, <span class="sig-arg">newpath</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Rename a file or folder from <code>oldpath</code> to <code>newpath</code>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>oldpath</code></strong> (str) - existing name of the file or folder</li> <li><strong class="pname"><code>newpath</code></strong> (str) - new name for the file or folder</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if <code>newpath</code> is a folder, or something else goes wrong</li> </ul></dd> </dl> </td></tr></table> </div> <a name="rmdir"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">rmdir</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Remove the folder named <code>path</code>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - name of the folder to remove</li> </ul></dd> </dl> </td></tr></table> </div> <a name="stat"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">stat</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Retrieve information about a file on the remote system. The return value is an object whose attributes correspond to the attributes of python's <code>stat</code> structure as returned by <code>os.stat</code>, except that it contains fewer fields. An SFTP server may return as much or as little info as it wants, so the results may vary from server to server.</p> <p>Unlike a python <code>stat</code> object, the result may not be accessed as a tuple. This is mostly due to the author's slack factor.</p> <p>The fields supported are: <code>st_mode</code>, <code>st_size</code>, <code>st_uid</code>, <code>st_gid</code>, <code>st_atime</code>, and <code>st_mtime</code>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - the filename to stat</li> </ul></dd> <dt>Returns: SFTPAttributes</dt> <dd>an object containing attributes about the given file</dd> </dl> </td></tr></table> </div> <a name="symlink"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">symlink</span>(<span class="sig-arg">self</span>, <span class="sig-arg">source</span>, <span class="sig-arg">dest</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Create a symbolic link (shortcut) of the <code>source</code> path at <code>destination</code>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>source</code></strong> (str) - path of the original file</li> <li><strong class="pname"><code>dest</code></strong> (str) - path of the newly created symlink</li> </ul></dd> </dl> </td></tr></table> </div> <a name="truncate"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">truncate</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>, <span class="sig-arg">size</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Change the size of the file specified by <code>path</code>. This usually extends or shrinks the size of the file, just like the <code>truncate()</code> method on python file objects.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path of the file to modify</li> <li><strong class="pname"><code>size</code></strong> (int or long) - the new size of the file</li> </ul></dd> </dl> </td></tr></table> </div> <a name="unlink"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">unlink</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Remove the file at the given path. This only works on files; for removing folders (directories), use <a href="paramiko.SFTPClient-class.html#rmdir" class="link">rmdir</a>.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path (absolute or relative) of the file to remove</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if the path refers to a folder (directory)</li> </ul></dd> </dl> </td></tr></table> </div> <a name="utime"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">utime</span>(<span class="sig-arg">self</span>, <span class="sig-arg">path</span>, <span class="sig-arg">times</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="paramiko.sftp_client-pysrc.html">source code</a></span> </td> </tr></table> <p>Set the access and modified times of the file specified by <code>path</code>. If <code>times</code> is <code>None</code>, then the file's access and modified times are set to the current time. Otherwise, <code>times</code> must be a 2-tuple of numbers, of the form <code>(atime, mtime)</code>, which is used to set the access and modified times, respectively. This bizarre API is mimicked from python for the sake of consistency -- I apologize.</p> <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>path</code></strong> (str) - path of the file to modify</li> <li><strong class="pname"><code>times</code></strong> (tuple(int)) - <code>None</code> or a tuple of (access time, modified time) in standard internet epoch time (seconds since 01 January 1970 GMT)</li> </ul></dd> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="paramiko-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Mon May 23 13:50:03 2011 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>