Re: equivalence mv file_or_folder ~/.Trash and tell app "Finder" to move file_or_folder to trash
Re: equivalence mv file_or_folder ~/.Trash and tell app "Finder" to move file_or_folder to trash
- Subject: Re: equivalence mv file_or_folder ~/.Trash and tell app "Finder" to move file_or_folder to trash
- From: Christopher Nebel <email@hidden>
- Date: Mon, 11 Dec 2006 20:26:37 -0800
On Dec 10, 2006, at 7:09 PM, Yvon Thoraval wrote:
i've wrote a small Ruby+osascript called "trash" it is able to
mimic to some extend the behaviour of the rm command line.
it is to be used from the command line, no UI at all.
it's goal is simply to move file or folder to the user trash NOT to
remove these.
some guy said that could be written with 2/3 lines of shell code, i
suppose he think that :
$ mv file_or_folder ~/.Trash
is equivalent to the osascript :
tell application "Finder" to move (file_or_folder as alias) to trash
i've learned, past years, that isn't equivalent mainly because
Finder is doing something "behind the scene".
is that true or not ?
As with many statements, it's true under certain conditions. The
shell script will do the same thing as the Finder script IF...
- the file is on the same volume as your home folder, AND...
- there isn't already a file in the trash with the same name.
Both of these are usually true for most users, but the first in
particular will often be false for users with multiple drives/
partitions or who use remote volumes often. Some Guy perhaps did not
realize that there are volume-specific Trash folders as well. As for
the second, Finder will rename the incoming item to avoid collisions
with items already in the Trash. This can be a bit annoying when you
need to fish something out of the trash, but it does mean that it's
possible to do so -- trashing something will never destroy data,
whereas mv(1) might.
--Chris Nebel
AppleScript Engineering
P.S.: Please don't cross-post messages to applescript-users and
applescript-studio -- they tend to be noisy to one list or the
other. If it has to do with Studio specifically, post to applescript-
studio; if it's a general AppleScript question, post to applescript-
users.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden