Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82501
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <1248283536@qq.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.071 |
| X-Spam-Evidence | '*H*': 0.87; '*S*': 0.01; 'elegant': 0.07; 'subject:file': 0.07; 'username,': 0.07; 'exits': 0.09; 'password)': 0.09; '"key"': 0.16; 'port))': 0.16; 'skip:p 40': 0.19; 'import': 0.22; 'server.': 0.24; 'host': 0.29; 'username': 0.31; 'file': 0.32; 'to:name:python-list': 0.33; 'subject:the': 0.34; 'subject:with': 0.35; 'skip:s 30': 0.35; 'there': 0.35; 'subject:?': 0.36; 'remote': 0.38; 'work?': 0.38; 'to:addr:python- list': 0.38; 'delete': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'more': 0.64; 'from:addr:1248283536': 0.84; 'from:addr:qq.com': 0.84; 'from:name:\xcb\xae\xbe\xb2\xc1\xf7\xc9\xee': 0.84; 'message- id:@qq.com': 0.84; 'received:qq.com': 0.84; 'x-mailer:qqmail 2.x': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201307; t=1418561397; bh=L85JkI/NFm5tw4Xco1rXbWkObZPHuQPFtTlx89UEbVs=; h=X-QQ-FEAT:X-QQ-SSF:X-HAS-ATTACH:X-QQ-BUSINESS-ORIGIN: X-Originating-IP:X-QQ-STYLE:X-QQ-mid:From:To:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:Date: X-Priority:Message-ID:X-QQ-MIME:X-Mailer:X-QQ-Mailer: X-QQ-SENDSIZE; b=f0SJZ+MIUpCxkOFND2F5UZrGZRc6hXCOPBKuBUvXY/boroYfkpEQMLIvWO3Oc+LnG BoR9cWbR5CiVPh9uBYDH2keyZbCrXt5x4L4YqXEl0V9+DLB84RH++iPvynmzx8iGEL 1KZUbMcX7LDZjz2hmJa/0Gni63o6MN9BbMByZ7K4= |
| X-QQ-FEAT | FRkVFvYdryWGLfv0QDomJGHxuQu8+L9CU18UyQjSaSehA06WLddu68tDhzX/a 5TRanOFOTE3tUJsMs3ILWbjHixYHYo93ioQbhudqVMrpaVwed31uAQs63tWwF+6r/Xf4hul rFsRGDbEhQYvcuf+O4oG1nIDuFjHW9Ho5/+81KzvWycEuJM1HN+ZUQuUnDcSwjiwD7A+ZVb phTLeJ5ztTA== |
| X-QQ-SSF | 00000000000000F000000000000000D |
| X-HAS-ATTACH | no |
| X-QQ-BUSINESS-ORIGIN | 2 |
| X-Originating-IP | 113.58.220.50 |
| X-QQ-STYLE | |
| X-QQ-mid | webmail603t1418561396t7535700 |
| From | "水静流深" <1248283536@qq.com> |
| To | "python-list" <python-list@python.org> |
| Subject | how to delete my file if exits in the remote server with paramiko? |
| Mime-Version | 1.0 |
| Content-Type | multipart/alternative; boundary="----=_NextPart_548D8774_09C46C70_579DEE66" |
| Content-Transfer-Encoding | 8Bit |
| Date | Sun, 14 Dec 2014 20:49:56 +0800 |
| X-Priority | 3 |
| X-QQ-MIME | TCMime 1.0 by Tencent |
| X-Mailer | QQMail 2.x |
| X-QQ-Mailer | QQMail 2.x |
| X-QQ-SENDSIZE | 520 |
| X-QQ-Bgrelay | 1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16944.1418561416.18130.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1418561416 news.xs4all.nl 2839 [2001:888:2000:d::a6]:48576 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:82501 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
I want to delete the file "names.txt" if it exits in "/home/names.txt" in my remote vps server.
import paramiko
host = "vps ip"
port = 22
transport = paramiko.Transport((host, port))
password = "key"
username = "root"
transport.connect(username = username, password = password)
sftp = paramiko.SFTPClient.from_transport(transport)
if "names.txt" in sftp.listdir("/home") : sftp.remove("/home/names.txt")
Is there more elegant way to do the same work?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
how to delete my file if exits in the remote server with paramiko? "水静流深" <1248283536@qq.com> - 2014-12-14 20:49 +0800 Re: how to delete my file if exits in the remote server with paramiko? Roy Smith <roy@panix.com> - 2014-12-14 10:58 -0500
csiph-web