Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mr Rabbit

macrumors 6502a
Original poster
May 13, 2013
638
5
'merica
Thanks to my heavy workload at the moment I'm drawing a blank on piecing this together. I can piece together bits and pieces of this whole task but for the life of me I can't put it all together.

I'm wanting to build a script that will execute when a Mac user logs in. The script checks for the presence of a folder ("~/Library/Application Support/Firefox" specifically). If it finds the folder it copies a file into one of it's subfolders and then removes itself, along with the login hook needed to run the script in the first place. If it does NOT find the specified folder then it exits quietly and runs again the next time the user logs in.

Any ideas?
 
Try this :-

#!/bin/sh
DIRECTORY=~/Library/Application Support/Firefox
if [[ -d "${DIRECTORY}" && ! -L "${DIRECTORY}" ]] ; then
echo "Directory exists\n"
else
echo "Directory doesn't exist\n"
fi
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.