rm does not always remove immediately
rm does not always remove immediately
- Subject: rm does not always remove immediately
- From: Luther Fuller <email@hidden>
- Date: Tue, 12 Dec 2006 07:52:37 -0600
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 ...
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