• 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
Re: rm does not always remove immediately
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm does not always remove immediately


  • Subject: Re: rm does not always remove immediately
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 15 Dec 2006 12:10:05 -0600

Thanks for the suggestion, Walter.
The "delay 3" is there just to see if the Finder/system needs some time to remove the item. (It doesn't) I've tried to use "Update" many times before over many years and I have never found anything that this command could do. Still, I need to try it ... so, I after a few minutes experimenting, I found this handler that works (!!!) ...


on remove(itemAlias)
	try
		tell application "Finder"
			set itemName to (name of itemAlias)
			set itemCont to (container of itemAlias) as alias
		end tell
		do shell script "rm -fr " & (quoted form of POSIX path of itemAlias)
		tell application "Finder" to update item itemName of itemCont
	end try
end remove -----------------------------------------

You would think that using simply ...

	tell application "Finder" to update itemAlias

would work just as well ... but it doesn't! I found the line that works by accident. The dictionary simply says that 'update' needs a reference, but it's seems to be picky about the exact nature of the reference. An alias won't do.

So, now I know one thing that 'update' is good for.


On Dec 15, 2006, at 11:08 AM, Walter Bushell wrote:


On Dec 15, 2006, at 11:41 AM, Walter Bushell wrote:


On Dec 12, 2006, at 10:52 AM, Emmanuel wrote:



I think that this does not mean that "rm" does not remove, only that Finder is not aware.


If I replace the "delay 3 etc" part of your script by a simple "get blah as alias" (with no delay) I get the file not found error all right.

Emmanuel



Ah, yes. It seems that if you do things behind the Finder's back, it does not register.

Upon further thought perhaps the "Update" verb of the finder should be used to bring the Finder's attention, it worked instead of the delay and it feels right.



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users


This email sent to email@hidden

_______________________________________________ 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: Emmanuel <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>)
 >rm does not always remove immediately (From: Luther Fuller <email@hidden>)
 >Re: rm does not always remove immediately (From: Emmanuel <email@hidden>)
 >Re: rm does not always remove immediately (From: Walter Bushell <email@hidden>)

  • Prev by Date: Re: awk question
  • Next by Date: Re: rm does not always remove immediately
  • Previous by thread: Re: rm does not always remove immediately
  • Next by thread: Re: rm does not always remove immediately
  • Index(es):
    • Date
    • Thread