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

RE: Delete a hidden file


  • Subject: RE: Delete a hidden file
  • From: "Geoff Graham" <email@hidden>
  • Date: Mon, 1 Nov 2010 12:26:53 -0400

You could try:

 

(file "Library:Application Support:.syssettings12a239c8044f4" of the startup disk) as string

 

that will fail if the file doesn’t exist, or give you the simple text path if it does. You should then be able to work with it the same as your hard coded paths. I just tried deleting a file using that reference and it worked.

 

Geoff

 

 

From: applescript-users-bounces+geoffg=email@hidden [mailto:applescript-users-bounces+geoffg=email@hidden] On Behalf Of Jason Lantz
Sent: Monday, November 01, 2010 12:02 PM
To: email@hidden
Subject: Delete a hidden file

 

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

References: 
 >Delete a hidden file (From: Jason Lantz <email@hidden>)

  • Prev by Date: Delete a hidden file
  • Next by Date: Re: Window watcher
  • Previous by thread: Delete a hidden file
  • Next by thread: Re: Delete a hidden file
  • Index(es):
    • Date
    • Thread