• 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
Delete a hidden file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Delete a hidden file


  • Subject: Delete a hidden file
  • From: Jason Lantz <email@hidden>
  • Date: Mon, 1 Nov 2010 12:01:49 -0400

I asked this question before, but was unable to make any of the suggestions work.   I think I need provide more detailed information, so I am trying again.

Objectives: 
1. To delete a specific hidden file
2. For the script to work on any machine (aka absent of hard coded file paths)
3. To delete the file without requiring the user to directly choose or select the file

Here's my original script (which works):

tell application "Finder"
try
exists file "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
if true then set trialcounter to "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
end try


delete trialcounter
end tell

And here are the results:

tell application "Finder"
exists file "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
false
delete "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
item ".syssettings12a239c8044f4 11-42-29" of item ".Trash" of folder "j.lantz" of folder "Users" of startup disk
end tell

Notice that despite the fact that the existence of the hidden file comes back false, the script proceeds anyway and somehow manages to delete the file.  Unfortunately, this script isn't sufficient for me because the file paths are hard coded.  To fix this I tried the following script.

tell application "Finder"
try
exists file "Library:Application Support:.syssettings12a239c8044f4" of the startup disk
if true then set trialcounter to "Library:Application Support:.syssettings12a239c8044f4" of the startup disk
end try


delete trialcounter
end tell

This is essentially the same as the first script except that I removed "Leopard HD" from the file path and replaced it with "of the startup disk" at the end.  This script returns a syntax error that says "Can't get 'Library:Application Support:.syssettings12a239c8044f4' of the startup disk. Access not allowed."

I feel like the solution here is probably quite simple, but I can't figure it out.  What am I doing wrong?


 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Delete a hidden file
      • From: Christopher Nebel <email@hidden>
    • Re: Delete a hidden file
      • From: Luther Fuller <email@hidden>
    • RE: Delete a hidden file
      • From: "Geoff Graham" <email@hidden>
  • Prev by Date: Re: Window watcher
  • Next by Date: RE: Delete a hidden file
  • Previous by thread: Re: Window watcher
  • Next by thread: RE: Delete a hidden file
  • Index(es):
    • Date
    • Thread