Re: rm does not always remove immediately
Re: rm does not always remove immediately
- Subject: Re: rm does not always remove immediately
- From: Clark Martin <email@hidden>
- Date: Tue, 12 Dec 2006 10:33:26 -0800
At 7:52 AM -0600 12/12/06, Luther Fuller wrote:
At one time, perhaps a year ago, use of 'do shell script "rm ..."'
would simply destroy an item immediately. A subsequent test in a
script would find the item gone.
Christopher Nebel's reply to Yvon Thoraval ("equivalence mv
file_or_folder ~/.Trash and tell app "Finder" to move
file_or_folder to trash") reminded me that this is no longer the
case and I'm curious why.
Some months ago, I found that after using 'do shell script "rm
..."', the file was still there. I have had to discontinue use of
'rm'. Rather that doing a lot of explaining, here's a test
application I just wrote ...
Well I just tried it and in either case (rm-test folder open or
closed) the "x" folder is gone. It looks like the same problem I've
been running into with a script I've been using for a long time,
Applescript and/or finder seems to be executing everything
asynchronously.
In my case the script is supposed to log in to a server then check
for the existence of a folder and determine it's privileges. It
determines that the folder isn't there because it tests for it before
the server has mounted.
If this is truly the case then AppleScript is becoming useless.
property testFolderName : "rm-test folder"
tell application "Finder"
if not (exists folder testFolderName of desktop) then
make new folder at desktop with properties
{name:testFolderName}
set testFolder to the result as alias
else
set testFolder to (folder testFolderName of desktop) as alias
end if
--
make new folder at testFolder with properties {name:"x"}
set testItem to the result as alias
--
try
"rm -fr " & (quoted form of POSIX path of testItem)
do shell script the result
on error
display dialog "Error during rm"
return
end try
--
delay 3
if exists folder "x" of testFolder then
"It's still there!"
else
"It's gone!"
end if
display dialog the result
end tell
NOTICE: the difference in behavior between running the script with
the folder "rm-test folder" closed vs open.
_______________________________________________
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
--
Clark Martin
Redwood City, CA, USA
Macintosh / Internet Consulting
"I'm a designated driver on the Information Super Highway"
_______________________________________________
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