• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
rm does not always remove immediately
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: rm does not always remove immediately
      • From: Clark Martin <email@hidden>
    • Re: rm does not always remove immediately
      • From: Emmanuel <email@hidden>
    • Re: rm does not always remove immediately
      • From: Peter Waibel <email@hidden>
References: 
 >Re: equivalence mv file_or_folder ~/.Trash and tell app "Finder" to move file_or_folder to trash (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Help! Connecting to MS SQL Server
  • Next by Date: Re: rm does not always remove immediately
  • Previous by thread: Re: equivalence mv file_or_folder ~/.Trash and tell app "Finder" to move file_or_folder to trash
  • Next by thread: Re: rm does not always remove immediately
  • Index(es):
    • Date
    • Thread