Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5538 > unrolled thread

Deleting a file?

Started by"garyr" <garyr@fidalgo.net>
First post2011-05-16 14:23 -0700
Last post2011-05-17 07:43 -0700
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Deleting a file? "garyr" <garyr@fidalgo.net> - 2011-05-16 14:23 -0700
    Re: Deleting a file? Ben Finney <ben+python@benfinney.id.au> - 2011-05-17 11:39 +1000
    Re: Deleting a file? Jerry Hill <malaclypse2@gmail.com> - 2011-05-16 23:06 -0400
      Re: Deleting a file? "garyr" <garyr@fidalgo.net> - 2011-05-17 07:43 -0700

#5538 — Deleting a file?

From"garyr" <garyr@fidalgo.net>
Date2011-05-16 14:23 -0700
SubjectDeleting a file?
Message-ID<iqsdtn$va2$1@speranza.aioe.org>
A file can be deleted by opening it with mode os.O_TEMPORARY and then 
closing it. How can a file be moved to the Recycle Bin, a la Windows?

[toc] | [next] | [standalone]


#5545

FromBen Finney <ben+python@benfinney.id.au>
Date2011-05-17 11:39 +1000
Message-ID<878vu6f6li.fsf@benfinney.id.au>
In reply to#5538
"garyr" <garyr@fidalgo.net> writes:

> A file can be deleted by opening it with mode os.O_TEMPORARY and then 
> closing it.

Much simpler: ‘os.remove(path)’.

> How can a file be moved to the Recycle Bin, a la Windows?

That's not deleting it (as you probably know), so you might better
change the subject field for the thread.

-- 
 \     “Unix is an operating system, OS/2 is half an operating system, |
  `\    Windows is a shell, and DOS is a boot partition virus.” —Peter |
_o__)                                                        H. Coffin |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#5546

FromJerry Hill <malaclypse2@gmail.com>
Date2011-05-16 23:06 -0400
Message-ID<mailman.1654.1305601607.9059.python-list@python.org>
In reply to#5538
On Mon, May 16, 2011 at 5:23 PM, garyr <garyr@fidalgo.net> wrote:
> A file can be deleted by opening it with mode os.O_TEMPORARY and then
> closing it. How can a file be moved to the Recycle Bin, a la Windows?

I see a send2trash module (http://hg.hardcoded.net/send2trash and
http://www.hardcoded.net/articles/send-files-to-trash-on-all-platforms.htm)

The source code looks pretty straightforward, but I don't think
there's anything in the standard library that does that.

-- 
Jerry

[toc] | [prev] | [next] | [standalone]


#5569

From"garyr" <garyr@fidalgo.net>
Date2011-05-17 07:43 -0700
Message-ID<iqu1ql$i5g$1@speranza.aioe.org>
In reply to#5546
Jerry,

There was an error during the install but only required a minor change to an
__init__.py file to correct.

Works great. Just what I was looking for. Many thanks!

Gary

"Jerry Hill" <malaclypse2@gmail.com> wrote in message
news:mailman.1654.1305601607.9059.python-list@python.org...
> On Mon, May 16, 2011 at 5:23 PM, garyr <garyr@fidalgo.net> wrote:
>> A file can be deleted by opening it with mode os.O_TEMPORARY and then
>> closing it. How can a file be moved to the Recycle Bin, a la Windows?
>
> I see a send2trash module (http://hg.hardcoded.net/send2trash and
> http://www.hardcoded.net/articles/send-files-to-trash-on-all-platforms.htm)
>
> The source code looks pretty straightforward, but I don't think
> there's anything in the standard library that does that.
>
> -- 
> Jerry



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web