1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!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"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
<tr valign="center">
<th class="navbar"> <a class="navbar" href="paramiko-module.html">Home</a> </th>
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
<th class="navbar"> <a class="navbar" 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%">
<font size="-1"><b class="breadcrumbs">
<a href="paramiko-module.html">Package paramiko</a> ::
Class SFTPClient
</b></font></br>
</td>
<td><table cellpadding="0" cellspacing="0">
<tr><td align="right"><font size="-2">[<a href="../private/paramiko.SFTPClient-class.html">show private</a> | hide private]</font></td></tr>
<tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a> | <a href="paramiko.SFTPClient-class.html" target="_top">no frames</a>]</font></td></tr>
</table></td>
</tr></table>
<!-- =========== START OF CLASS DESCRIPTION =========== -->
<h2 class="class">Type SFTPClient</h2>
<pre class="base-tree">
<a href="__builtin__.object-class.html"><code>object</code></a> --+
|
<a href="../private/paramiko.BaseSFTP-class.html"><code>BaseSFTP</code></a> --+
|
<b>SFTPClient</b>
</pre><br />
<dl><dt><b>Known Subclasses:</b></dt>
<dd>
<a href="paramiko.SFTP-class.html"><code>SFTP</code></a></dd></dl>
<hr/>
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"><code>Transport</code></a> and do remote file
operations.
<hr/>
<!-- =========== START OF METHOD SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
<th colspan="2">Method Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#__init__" class="summary-sig-name"><code>__init__</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>sock</span>)</span></code>
<br />
Create an SFTP client from an existing <a
href="paramiko.Channel-class.html"
class="link"><code>Channel</code></a>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><a name="__del__"></a><span class="summary-sig"><span class="summary-sig-name">__del__</span>(<span class=summary-sig-arg>self</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#chdir" class="summary-sig-name"><code>chdir</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Change the "current directory" of this SFTP session.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#chmod" class="summary-sig-name"><code>chmod</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>,
<span class=summary-sig-arg>mode</span>)</span></code>
<br />
Change the mode (permissions) of a file.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#chown" class="summary-sig-name"><code>chown</code></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></code>
<br />
Change the owner (<code>uid</code>) and group (<code>gid</code>) of a
file.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#close" class="summary-sig-name"><code>close</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Close the SFTP session and its underlying channel.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> SFTPFile
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#file" class="summary-sig-name"><code>file</code></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-arg>bufsize</span>)</span></code>
<br />
Open a file on the remote server.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> <a href="paramiko.SFTPClient-class.html"
class="link"><code>SFTPClient</code></a>
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#from_transport" class="summary-sig-name"><code>from_transport</code></a>(<span class=summary-sig-arg>selfclass</span>,
<span class=summary-sig-arg>t</span>)</span></code>
<br />
Create an SFTP client channel from an open <a
href="paramiko.Transport-class.html"
class="link"><code>Transport</code></a>. <i>(Class method)</i>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#get" class="summary-sig-name"><code>get</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>remotepath</span>,
<span class=summary-sig-arg>localpath</span>)</span></code>
<br />
Copy a remote file (<code>remotepath</code>) from the SFTP server to
the local host as <code>localpath</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> str
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#getcwd" class="summary-sig-name"><code>getcwd</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
<br />
Return the "current working directory" for this SFTP
session, as emulated by paramiko.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> list of str
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#listdir" class="summary-sig-name"><code>listdir</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Return a list containing the names of the entries in the given
<code>path</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> list of <a href="paramiko.SFTPAttributes-class.html"
class="link"><code>SFTPAttributes</code></a>
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#listdir_attr" class="summary-sig-name"><code>listdir_attr</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Return a list containing <a href="paramiko.SFTPAttributes-class.html"
class="link"><code>SFTPAttributes</code></a> objects corresponding to
files in the given <code>path</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> SFTPAttributes
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#lstat" class="summary-sig-name"><code>lstat</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Retrieve information about a file on the remote system, without
following symbolic links (shortcuts).</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#mkdir" class="summary-sig-name"><code>mkdir</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>,
<span class=summary-sig-arg>mode</span>)</span></code>
<br />
Create a folder (directory) named <code>path</code> with numeric mode
<code>mode</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> str
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#normalize" class="summary-sig-name"><code>normalize</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Return the normalized path (on the server) of a given path.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> SFTPFile
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#file" class="summary-sig-name"><code>open</code></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-arg>bufsize</span>)</span></code>
<br />
Open a file on the remote server.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#put" class="summary-sig-name"><code>put</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>localpath</span>,
<span class=summary-sig-arg>remotepath</span>)</span></code>
<br />
Copy a local file (<code>localpath</code>) to the SFTP server as
<code>remotepath</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> str
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#readlink" class="summary-sig-name"><code>readlink</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Return the target of a symbolic link (shortcut).</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#remove" class="summary-sig-name"><code>remove</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Remove the file at the given path.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#rename" class="summary-sig-name"><code>rename</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>oldpath</span>,
<span class=summary-sig-arg>newpath</span>)</span></code>
<br />
Rename a file or folder from <code>oldpath</code> to
<code>newpath</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#rmdir" class="summary-sig-name"><code>rmdir</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Remove the folder named <code>path</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> SFTPAttributes
</font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#stat" class="summary-sig-name"><code>stat</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Retrieve information about a file on the remote system.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#symlink" class="summary-sig-name"><code>symlink</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>source</span>,
<span class=summary-sig-arg>dest</span>)</span></code>
<br />
Create a symbolic link (shortcut) of the <code>source</code> path at
<code>destination</code>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#remove" class="summary-sig-name"><code>unlink</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>)</span></code>
<br />
Remove the file at the given path.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="paramiko.SFTPClient-class.html#utime" class="summary-sig-name"><code>utime</code></a>(<span class=summary-sig-arg>self</span>,
<span class=summary-sig-arg>path</span>,
<span class=summary-sig-arg>times</span>)</span></code>
<br />
Set the access and modified times of the file specified by
<code>path</code>.</td></tr>
<tr bgcolor="#e8f0f8" class="group">
<th colspan="2"> Inherited from object</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__delattr__" class="summary-sig-name"><code>__delattr__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__delattr__('name') <==> del x.name</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__getattribute__" class="summary-sig-name"><code>__getattribute__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__getattribute__('name') <==> x.name</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__hash__" class="summary-sig-name"><code>__hash__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__hash__() <==> hash(x)</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__new__" class="summary-sig-name"><code>__new__</code></a>(<span class=summary-sig-arg>T</span>,
<span class=summary-sig-arg>S</span>,
<span class="summary-sig-vararg">...</span>)</span></code>
<br />
T.__new__(S, ...) -> a new object with type S, a subtype of T</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__reduce__" class="summary-sig-name"><code>__reduce__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
helper for pickle</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__reduce_ex__" class="summary-sig-name"><code>__reduce_ex__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
helper for pickle</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__repr__" class="summary-sig-name"><code>__repr__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__repr__() <==> repr(x)</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__setattr__" class="summary-sig-name"><code>__setattr__</code></a>(<span class="summary-sig-vararg">...</span>)</span></code>
<br />
x.__setattr__('name', value) <==> x.name = value</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
<td><code><span class="summary-sig"><a href="__builtin__.object-class.html#__str__" class="summary-sig-name"><code>__str__</code></a>(<span class=summary-sig-arg>x</span>)</span></code>
<br />
x.__str__() <==> str(x)</td></tr>
</table><br />
<!-- =========== START OF INSTANCE METHOD DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
<th colspan="2">Instance Method Details</th></tr>
</table>
<a name="__init__"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">__init__</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>sock</span>)</span>
<br /><i>(Constructor)</i>
</h3>
<p>Create an SFTP client from an existing <a
href="paramiko.Channel-class.html"
class="link"><code>Channel</code></a>. The channel should already have
requested the <code>"sftp"</code> subsystem.</p>
An alternate way to create an SFTP client context is by using <a
href="paramiko.SFTPClient-class.html#from_transport"
class="link"><code>from_transport</code></a>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>sock</b></code> -
an open <a href="paramiko.Channel-class.html"
class="link"><code>Channel</code></a> using the
<code>"sftp"</code> subsystem.
<br /><i>
(type=<a href="paramiko.Channel-class.html"
class="link"><code>Channel</code></a>)</i>
</dd>
</dl>
<dl><dt><b>Overrides:</b></dt>
<dd><a href="../private/paramiko.BaseSFTP-class.html#__init__"><code>paramiko.BaseSFTP.__init__</code></a></dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="chdir"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">chdir</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
new current working directory
<br /><i>
(type=str)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if the requested path doesn't exist on the server
</dl>
<p><b>Since:</b> 1.4
</p>
</dd></dl>
</td></tr></table>
<a name="chmod"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path of the file to change the permissions of.
<br /><i>
(type=string)</i>
<dd><code><b>mode</b></code> -
new permissions.
<br /><i>
(type=int)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="chown"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
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"><code>stat</code></a> first to retrieve the current owner
and group.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path of the file to change the owner and group of.
<br /><i>
(type=string)</i>
<dd><code><b>uid</b></code> -
new owner's uid
<br /><i>
(type=int)</i>
<dd><code><b>gid</b></code> -
new group id
<br /><i>
(type=int)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="close"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">close</span>(<span class=sig-arg>self</span>)</span>
</h3>
Close the SFTP session and its underlying channel.
<dl><dt></dt><dd>
<p><b>Since:</b> 1.4
</p>
</dd></dl>
</td></tr></table>
<a name="file"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>'r'</span>,
<span class=sig-arg>bufsize</span>=<span class=sig-default>-1</span>)</span>
</h3>
<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>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>filename</b></code> -
name of the file to open.
<br /><i>
(type=string)</i>
<dd><code><b>mode</b></code> -
mode (python-style) to open in.
<br /><i>
(type=string)</i>
<dd><code><b>bufsize</b></code> -
desired buffering (-1 = default buffer size)
<br /><i>
(type=int)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
a file object representing the open file.
<br /><i>
(type=SFTPFile)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if the file could not be opened.
</dl>
</dd></dl>
</td></tr></table>
<a name="get"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
</h3>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>remotepath</b></code> -
the remote file to copy
<br /><i>
(type=str)</i>
<dd><code><b>localpath</b></code> -
the destination path on the local host
<br /><i>
(type=str)</i>
</dd>
</dl>
<p><b>Since:</b> 1.4
</p>
</dd></dl>
</td></tr></table>
<a name="getcwd"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">getcwd</span>(<span class=sig-arg>self</span>)</span>
</h3>
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"><code>chdir</code></a>, this method will return
<code>None</code>.
<dl><dt></dt><dd>
<dl><dt><b>Returns:</b></dt>
<dd>
the current working directory on the server, or
<code>None</code>
<br /><i>
(type=str)</i>
</dd>
</dl>
<p><b>Since:</b> 1.4
</p>
</dd></dl>
</td></tr></table>
<a name="listdir"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>'.'</span>)</span>
</h3>
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"><code>SFTPAttributes</code></a> objects, see <a
href="paramiko.SFTPClient-class.html#listdir_attr"
class="link"><code>listdir_attr</code></a>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path to list (defaults to <code>'.'</code>)
<br /><i>
(type=str)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
list of filenames
<br /><i>
(type=list of str)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="listdir_attr"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>'.'</span>)</span>
</h3>
Return a list containing <a
href="paramiko.SFTPAttributes-class.html"
class="link"><code>SFTPAttributes</code></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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path to list (defaults to <code>'.'</code>)
<br /><i>
(type=str)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
list of attributes
<br /><i>
(type=list of <a href="paramiko.SFTPAttributes-class.html"
class="link"><code>SFTPAttributes</code></a>)</i>
</dd>
</dl>
<p><b>Since:</b> 1.2
</p>
</dd></dl>
</td></tr></table>
<a name="lstat"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">lstat</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
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"><code>stat</code></a>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
the filename to stat.
<br /><i>
(type=string)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
an object containing attributes about the given file.
<br /><i>
(type=SFTPAttributes)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="mkdir"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
name of the folder to create.
<br /><i>
(type=string)</i>
<dd><code><b>mode</b></code> -
permissions (posix-style) for the newly-created folder.
<br /><i>
(type=int)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="normalize"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">normalize</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
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>).
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path to be normalized.
<br /><i>
(type=str)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
normalized form of the given path.
<br /><i>
(type=str)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if the path can't be resolved on the server
</dl>
</dd></dl>
</td></tr></table>
<a name="file"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>'r'</span>,
<span class=sig-arg>bufsize</span>=<span class=sig-default>-1</span>)</span>
</h3>
<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>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>filename</b></code> -
name of the file to open.
<br /><i>
(type=string)</i>
<dd><code><b>mode</b></code> -
mode (python-style) to open in.
<br /><i>
(type=string)</i>
<dd><code><b>bufsize</b></code> -
desired buffering (-1 = default buffer size)
<br /><i>
(type=int)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
a file object representing the open file.
<br /><i>
(type=SFTPFile)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if the file could not be opened.
</dl>
</dd></dl>
</td></tr></table>
<a name="put"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
</h3>
<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>
The SFTP operations use pipelining for speed.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>localpath</b></code> -
the local file to copy
<br /><i>
(type=str)</i>
<dd><code><b>remotepath</b></code> -
the destination path on the SFTP server
<br /><i>
(type=str)</i>
</dd>
</dl>
<p><b>Since:</b> 1.4
</p>
</dd></dl>
</td></tr></table>
<a name="readlink"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">readlink</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
Return the target of a symbolic link (shortcut). You can use <a
href="paramiko.SFTPClient-class.html#symlink"
class="link"><code>symlink</code></a> to create these. The result may
be either an absolute or relative pathname.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path of the symbolic link file.
<br /><i>
(type=str)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
target path.
<br /><i>
(type=str)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="remove"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">remove</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
Remove the file at the given path.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path (absolute or relative) of the file to remove.
<br /><i>
(type=string)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if the path refers to a folder (directory). Use <a
href="paramiko.SFTPClient-class.html#rmdir"
class="link"><code>rmdir</code></a> to remove a folder.
</dl>
</dd></dl>
</td></tr></table>
<a name="rename"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
Rename a file or folder from <code>oldpath</code> to
<code>newpath</code>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>oldpath</b></code> -
existing name of the file or folder.
<br /><i>
(type=string)</i>
<dd><code><b>newpath</b></code> -
new name for the file or folder.
<br /><i>
(type=string)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if <code>newpath</code> is a folder, or something else goes
wrong.
</dl>
</dd></dl>
</td></tr></table>
<a name="rmdir"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">rmdir</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
Remove the folder named <code>path</code>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
name of the folder to remove.
<br /><i>
(type=string)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="stat"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">stat</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
<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>
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>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
the filename to stat.
<br /><i>
(type=string)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
an object containing attributes about the given file.
<br /><i>
(type=SFTPAttributes)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="symlink"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
Create a symbolic link (shortcut) of the <code>source</code> path at
<code>destination</code>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>source</b></code> -
path of the original file.
<br /><i>
(type=string)</i>
<dd><code><b>dest</b></code> -
path of the newly created symlink.
<br /><i>
(type=string)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<a name="remove"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">unlink</span>(<span class=sig-arg>self</span>,
<span class=sig-arg>path</span>)</span>
</h3>
Remove the file at the given path.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path (absolute or relative) of the file to remove.
<br /><i>
(type=string)</i>
</dd>
</dl>
<dl><dt><b>Raises:</b></dt>
<dd><code><b>IOError</b></code> -
if the path refers to a folder (directory). Use <a
href="paramiko.SFTPClient-class.html#rmdir"
class="link"><code>rmdir</code></a> to remove a folder.
</dl>
</dd></dl>
</td></tr></table>
<a name="utime"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><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>
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.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>path</b></code> -
path of the file to modify.
<br /><i>
(type=string)</i>
<dd><code><b>times</b></code> -
<code>None</code> or a tuple of (access time, modified time)
in standard internet epoch time (seconds since 01 January 1970
GMT).
<br /><i>
(type=tuple of int)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<br />
<!-- =========== START OF CLASS METHOD DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
<th colspan="2">Class Method Details</th></tr>
</table>
<a name="from_transport"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
<h3><span class="sig"><span class="sig-name">from_transport</span>(<span class=sig-arg>selfclass</span>,
<span class=sig-arg>t</span>)</span>
</h3>
Create an SFTP client channel from an open <a
href="paramiko.Transport-class.html"
class="link"><code>Transport</code></a>.
<dl><dt></dt><dd>
<dl><dt><b>Parameters:</b></dt>
<dd><code><b>t</b></code> -
an open <a href="paramiko.Transport-class.html"
class="link"><code>Transport</code></a> which is already
authenticated.
<br /><i>
(type=<a href="paramiko.Transport-class.html"
class="link"><code>Transport</code></a>)</i>
</dd>
</dl>
<dl><dt><b>Returns:</b></dt>
<dd>
a new <a href="paramiko.SFTPClient-class.html"
class="link"><code>SFTPClient</code></a> object, referring to an
sftp session (channel) across the transport.
<br /><i>
(type=<a href="paramiko.SFTPClient-class.html"
class="link"><code>SFTPClient</code></a>)</i>
</dd>
</dl>
</dd></dl>
</td></tr></table>
<br />
<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
<tr valign="center">
<th class="navbar"> <a class="navbar" href="paramiko-module.html">Home</a> </th>
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
<th class="navbar"> <a class="navbar" 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"><font size="-2">Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005</font></td>
<td align="right"><a href="http://epydoc.sourceforge.net"
><font size="-2">http://epydoc.sf.net</font></a></td>
</tr>
</table>
</body>
</html>
|