Checking for existance of hidden file and deleting it.

Hi

I need to write a script that will check for the existence of an invisible file with a known name that is located in a known directory. If the file exists, it needs to be deleted. The file is located in /Library/Preferences… the file itself is: “.L8457789”

How do I do this?

Thanks

Stefan Garr

try
	do shell script "rm /Library/Preferences/.L8457789"
end try

Hi

Thanks, but it doesn’t seem to work. This is an invisible file, and it’s in the preferences folder. When I do a “get info” on the file, it says there’s no application to open it, or it’s in a folder that I don’t have permission to change. How would the script be altered to temporarily adjust permissions?

Stefan

How do you do a get info on an invisible file?

– Rob

First you have to make it visible, (one way is to use TinkerTool) unless you want to go to the terminal and do an “ls” command. I just had a buddy on the phone helping me to break down the commands at the command line (in the terminal) I’m learning as I go. Since writing my last reply when I said the script I was given wouldn’t work, I found that I just had a couple of errors in the “shell” part of the script. So, I’ve gotten it to work!

Thanks to all

Stefan