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


Groups > comp.lang.python > #90648

Re: Survey -- Move To Trash function in Python?

References (2 earlier) <55554ddb$0$12995$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmokNo3e1=LEBBnC_6zQmtP=Smh7bXm-uCsGEew4sKZ52Q@mail.gmail.com> <CALwzidkTXnbwcGPa5tK_fV_Rg1B7pX2rVK+0JPVdwLXu+CD7NQ@mail.gmail.com> <mailman.23.1431658586.17265.python-list@python.org> <55557185$0$12987$c3e8da3$5496439d@news.astraweb.com>
Date 2015-05-15 14:25 +1000
Subject Re: Survey -- Move To Trash function in Python?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.24.1431663948.17265.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, May 15, 2015 at 2:09 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
>> Yes, but sometimes it's at the file system's discretion - particularly
>> when you're working with network mounts. The application may not even
>> know that the file got hard deleted.
>
> Citation needed.
>
> "Move to trash" is a move operation, not an unlink. By definition, it is
> reversible. Which platforms/file systems implements it as an unlink?
>
> (I think the answer is, "broken ones".)

With individual files, you're right that it's broken systems; I do
recall having some setups with network mounts where the "trash"
request was sent over to a remote system and that system, for whatever
reason, chose to delete since it was unable to trash. However, it's
worth noting that a lot of trash cans have strict capacity
limitations, and trashing an entire directory may well result in most
of its content being hard-deleted (or, to be technically correct,
trashed and then purged before the user had a chance to do anything).
And to add insult to injury, some systems (which shall remain
nameless, despite being well known for using UTF-16 file names and
other such anomalies) have such appalling trash-management algorithms
that deleting an entire directory becomes a ridiculously slow
operation - I suspect there's some sort of O(n) linear search being
done for every trashed file, resulting in quadratic performance for
trashing a directory. And when the directory in question is a set of
files that can't usefully be used individually, I'd really rather tell
the application to just hard-delete the whole lot... but that
application didn't even give that option. Anyway.

The main thing is that trashing invites the system to delete the file
at its leisure, so it'll consume disk space and be undeletable for an
unspecified and highly uncertain period of time. If you're depending
on your trash can to protect you, you're just as vulnerable as someone
who depends on disk-level undeletion. There's no solution to that; it
comes down to one of the two hardest problems in computing (cache
management).

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Survey -- Move To Trash function in Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 01:45 +1000
  Re: Survey -- Move To Trash function in Python? Grant Edwards <invalid@invalid.invalid> - 2015-05-14 15:49 +0000
    Re: Survey -- Move To Trash function in Python? Chris Angelico <rosuav@gmail.com> - 2015-05-15 01:59 +1000
      Re: Survey -- Move To Trash function in Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 12:28 +1000
    Re: Survey -- Move To Trash function in Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 11:37 +1000
      Re: Survey -- Move To Trash function in Python? Chris Angelico <rosuav@gmail.com> - 2015-05-15 11:53 +1000
      Re: Survey -- Move To Trash function in Python? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-14 20:49 -0600
      Re: Survey -- Move To Trash function in Python? Chris Angelico <rosuav@gmail.com> - 2015-05-15 12:56 +1000
        Re: Survey -- Move To Trash function in Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 14:09 +1000
          Re: Survey -- Move To Trash function in Python? Chris Angelico <rosuav@gmail.com> - 2015-05-15 14:25 +1000
          Re: Survey -- Move To Trash function in Python? random832@fastmail.us - 2015-05-15 14:27 -0400
            Re: Survey -- Move To Trash function in Python? sohcahtoa82@gmail.com - 2015-05-15 17:04 -0700
          Re: Survey -- Move To Trash function in Python? Chris Angelico <rosuav@gmail.com> - 2015-05-16 04:33 +1000
  Re: Survey -- Move To Trash function in Python? Dave Farrance <DaveFarrance@OMiTTHiSyahooANDTHiS.co.uk> - 2015-05-14 18:32 +0100
    Re: Survey -- Move To Trash function in Python? Grant Edwards <invalid@invalid.invalid> - 2015-05-14 18:11 +0000
      Re: Survey -- Move To Trash function in Python? Chris Warrick <kwpolska@gmail.com> - 2015-05-14 20:43 +0200
      Re: Survey -- Move To Trash function in Python? Ethan Furman <ethan@stoneleaf.us> - 2015-05-14 12:32 -0700
    Re: Survey -- Move To Trash function in Python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-15 12:03 +1000
      Re: Survey -- Move To Trash function in Python? Terry Reedy <tjreedy@udel.edu> - 2015-05-14 22:27 -0400
  Re: Survey -- Move To Trash function in Python? Ethan Furman <ethan@stoneleaf.us> - 2015-05-14 11:29 -0700
  Re: Survey -- Move To Trash function in Python? iMath <redstone-cold@163.com> - 2015-05-18 03:31 -0700
    Re: Survey -- Move To Trash function in Python? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-18 14:46 +0100

csiph-web