Re: How to empty the Trash programmatically?

2010-04-17 Thread Flavio Donadio
People, This my first post on this list, and I am very disappointed that I am chiming into this kind of conversation. This will be my only post on this subject and I think I can make myself very clear. On 16/04/2010, at 14:22, Jayson Adams wrote: On Apr 16, 2010, at 9:46 AM, Kyle Sluder

How to empty the Trash programmatically?

2010-04-16 Thread Oleg Krupnov
Hi, Is there a way to programmatically empty the Trash can? I could delete all files from /Users/account/.Trash folder, but I am not sure if it's a legitimate way. Also it will not include trashed files from other volumes, stored in /.Trashes/account id. The latter are generally not accessible

Re: How to empty the Trash programmatically?

2010-04-16 Thread Dave Carrigan
On Apr 15, 2010, at 11:05 PM, Oleg Krupnov wrote: I could delete all files from /Users/account/.Trash folder, but I am not sure if it's a legitimate way. It's not, because it will anger anybody who prefers to empty the trash securely. ___

Re: How to empty the Trash programmatically?

2010-04-16 Thread Stephen J. Butler
On Fri, Apr 16, 2010 at 1:05 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: Hi, Is there a way to programmatically empty the Trash can? This code is ancient, but it should give you an idea where to start writing a modern version:

Re: How to empty the Trash programmatically?

2010-04-16 Thread Charles Srstka
On Apr 16, 2010, at 1:05 AM, Oleg Krupnov wrote: Hi, Is there a way to programmatically empty the Trash can? I could delete all files from /Users/account/.Trash folder, but I am not sure if it's a legitimate way. Also it will not include trashed files from other volumes, stored in

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jens Alfke
On Apr 15, 2010, at 11:05 PM, Oleg Krupnov wrote: Is there a way to programmatically empty the Trash can? Send the Finder an ‘Empty Trash’ AppleEvent. You can use the scripting bridge API to do this pretty easily. —Jens___ Cocoa-dev mailing list

Re: How to empty the Trash programmatically?

2010-04-16 Thread Oleg Krupnov
What is securely in this context? On Fri, Apr 16, 2010 at 9:14 AM, Dave Carrigan d...@rudedog.org wrote: On Apr 15, 2010, at 11:05 PM, Oleg Krupnov wrote: I could delete all files from /Users/account/.Trash folder, but I am not sure if it's a legitimate way. It's not, because it will anger

Re: How to empty the Trash programmatically?

2010-04-16 Thread Oleg Krupnov
Yes, I see that I can use AppleScript. But is this really the only way? I would like to avoid Finder UIs popping up. On Fri, Apr 16, 2010 at 9:30 AM, Jens Alfke j...@mooseyard.com wrote: On Apr 15, 2010, at 11:05 PM, Oleg Krupnov wrote: Is there a way to programmatically empty the Trash can?

Re: How to empty the Trash programmatically?

2010-04-16 Thread Dave Keck
tell application Finder to empty trash without warns before emptying ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at

Re: How to empty the Trash programmatically?

2010-04-16 Thread Oleg Krupnov
But the progress-bar window will still pop up... On Fri, Apr 16, 2010 at 9:41 AM, Dave Keck davek...@gmail.com wrote: tell application Finder to empty trash without warns before emptying ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: How to empty the Trash programmatically?

2010-04-16 Thread Dave Keck
But the progress-bar window will still pop up... I would consider that a part of the high-level concept of emptying the trash. NSFileManager is probably what you're looking for, in combination with the mentioned AppleScript to update the trash icon: http://pastie.org/922743 Needs

Re: How to empty the Trash programmatically?

2010-04-16 Thread Dave Keck
Forgive me for posting before reading all of your original message - having done so I see my response doesn't help much. Sorry for the noise. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments

Re: How to empty the Trash programmatically?

2010-04-16 Thread Graham Cox
Don't. The only app that the user wants to empty the trash is Finder, not yours. If they want it emptied (or emptied securely), they'll go to the Finder and use the menu there. It's OK for your app to move stuff to the trash as long as it's clear to the user that will happen, but emptying it

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jeremy Pereira
On 16 Apr 2010, at 08:22, Graham Cox wrote: Don't. The only app that the user wants to empty the trash is Finder, not yours. If they want it emptied (or emptied securely), they'll go to the Finder and use the menu there. It's OK for your app to move stuff to the trash as long as it's

Re: How to empty the Trash programmatically?

2010-04-16 Thread Matt Gough
On 16 Apr 2010, at 09:46:27, Jeremy Pereira wrote: On 16 Apr 2010, at 08:22, Graham Cox wrote: Don't. The only app that the user wants to empty the trash is Finder, not yours. If they want it emptied (or emptied securely), they'll go to the Finder and use the menu there. It's OK for

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jeremy Pereira
On 16 Apr 2010, at 10:29, Matt Gough wrote: On 16 Apr 2010, at 09:46:27, Jeremy Pereira wrote: On 16 Apr 2010, at 08:22, Graham Cox wrote: Don't. The only app that the user wants to empty the trash is Finder, not yours. If they want it emptied (or emptied securely), they'll go to

Re: How to empty the Trash programmatically?

2010-04-16 Thread Raffael Cavallaro
On Apr 16, 2010, at 4:46 AM, Jeremy Pereira wrote: +1 to that. Any application that emptied my Trash programmatically would find itself being the first new item in there. ditto. soapbox The whole reason the trash exists is so users do not accidentally lose data. It gives them the

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jens Alfke
On Apr 15, 2010, at 11:45 PM, Oleg Krupnov wrote: But the progress-bar window will still pop up… Every once in a while a question on cocoa-dev gives me the uncomfortable feeling that someone is trying to get help in writing a piece of malware. This is one of them. No offense if that’s not

Re: How to empty the Trash programmatically?

2010-04-16 Thread Oleg Krupnov
The only app that the user wants to empty the trash is Finder, not yours. If they want it emptied (or emptied securely), they'll go to the Finder and use the menu there. It's OK for your app to move stuff to the trash as long as it's clear to the user that will happen, but emptying it is

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jens Alfke
On Apr 16, 2010, at 9:07 AM, Oleg Krupnov wrote: No, Jens, your feeling is wrong. I'm developing an app for disk space management, particularly for freeing up disk space. Actually you can take a look: http://www.daisydiskapp.com. The new version of the app I am developing will allow deleting

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jayson Adams
On Apr 16, 2010, at 12:22 AM, Graham Cox wrote: Don't. The only app that the user wants to empty the trash is Finder, not yours. If they want it emptied (or emptied securely), they'll go to the Finder and use the menu there. It's OK for your app to move stuff to the trash as long as

Re: How to empty the Trash programmatically?

2010-04-16 Thread Kyle Sluder
On Fri, Apr 16, 2010 at 9:30 AM, Jayson Adams jay...@circusponies.com wrote: Hey all of you of limited vision standing on your soapboxes - give me a break!  He couldn't possibly be asking because he wants to create a Finder/desktop replacement app (like the Finder works so well we don't need

Re: How to empty the Trash programmatically?

2010-04-16 Thread Raffael Cavallaro
On Apr 16, 2010, at 12:30 PM, Jayson Adams wrote: He couldn't possibly be asking because he wants to create a Finder/desktop replacement app (like the Finder works so well we don't need one of those). Before replacing the Finder with a superior implementation one might want to be aware of

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jayson Adams
On Apr 16, 2010, at 9:46 AM, Kyle Sluder wrote: On Fri, Apr 16, 2010 at 9:30 AM, Jayson Adams jay...@circusponies.com wrote: These kinds of preachy know-it-all rants are really tiresome, but unfortunately they happen a lot on this list. They happen a lot on this list because that kind

Re: How to empty the Trash programmatically?

2010-04-16 Thread Paul Sanders
But emptying the trash will delete files on *other mounted volumes* as well, not just the disk being examined. rm -rf ~/.Trash/* For volumes other than the startup volume it is a little more complicated: rm -rf /Volumes/volume_name/.Trashes/uid/* The Finder seems to notice when you do this

Re: How to empty the Trash programmatically?

2010-04-16 Thread Raffael Cavallaro
On Apr 16, 2010, at 1:43 PM, Paul Sanders wrote: But emptying the trash will delete files on *other mounted volumes* as well, not just the disk being examined. rm -rf ~/.Trash/* For volumes other than the startup volume it is a little more complicated: rm -rf

Re: How to empty the Trash programmatically?

2010-04-16 Thread Jens Alfke
On Apr 16, 2010, at 10:43 AM, Paul Sanders wrote: rm -rf ~/.Trash/* For volumes other than the startup volume it is a little more complicated: rm -rf /Volumes/volume_name/.Trashes/uid/* Please don't hardcode those paths. Use system APIs like FindFolder instead to locate the trash

Re: How to empty the Trash programmatically?

2010-04-16 Thread Paul Sanders
Please don't hardcode those paths. Use system APIs like FindFolder instead to locate the trash directory for a given volume. Well, OK, but you get the idea. Paul Sanders. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not

Re: How to empty the Trash programmatically?

2010-04-16 Thread Quincey Morris
On Apr 16, 2010, at 11:03, Raffael Cavallaro wrote: Again, someone who doesn't have an expert knowledge of the intended operation of the Finder and an equally experienced knowledge of user expectations shouldn't be doing this. In the [possibly] few moments that remain before this thread is

Re: How to empty the Trash programmatically?

2010-04-16 Thread Uli Kusterer
On 16.04.10 11:29, Matt Gough wrote: To be fair though, if it is a user-initiated emptying and it is done via Finder, then I think it is fine to initiate a Trash emptying from another app. What isn't fine is for it to be done behind the user's back. As long as it is obvious that this empties

Re: How to empty the Trash programmatically?

2010-04-16 Thread Paul Sanders
As long as it is obvious that this empties the system-wide trash. After all, Mail.app and other programs have their own trashes, and you wouldn't want a user to think they're emptying a local trash and suddenly delete a file they meant to recover. In case it wasn't obvious, my earlier rm -rf

Re: How to empty the Trash programmatically?

2010-04-16 Thread Graham Cox
On 17/04/2010, at 4:41 AM, Quincey Morris wrote: We keep shooting ourselves in the foot on this list by not first asking enough questions. Why should we though? If a poster can't muster the effort to sketch an outline of why they want to do a certain thing, it falls into the category of