I've been trying to get a script working that will do the following things:
1. Create a new folder everyday, on startup, with that day's date as the folder name. (The easy part)
2. Create an alias (or rather update the existing alias) on the desktop that points to this newly created folder. (this is what I can't figure out)
3. Only create the folder once in a day (seems to work ok)
So far I am able to create the folders ok, and even with multiple reboots it still seems to work, as if the folder exists I won't create it again. The problem is I can't get the alias to update/replace. It does, however, seem to create one in the folder that the original alias points to. Can anyone help? Here's where my script is currently (a bit of a mess as i've been messing with it for a while):
Thanks
1. Create a new folder everyday, on startup, with that day's date as the folder name. (The easy part)
2. Create an alias (or rather update the existing alias) on the desktop that points to this newly created folder. (this is what I can't figure out)
3. Only create the folder once in a day (seems to work ok)
So far I am able to create the folders ok, and even with multiple reboots it still seems to work, as if the folder exists I won't create it again. The problem is I can't get the alias to update/replace. It does, however, seem to create one in the folder that the original alias points to. Can anyone help? Here's where my script is currently (a bit of a mess as i've been messing with it for a while):
Code:
function alias {
readlink -n ~/Desktop/_AUDIO_FILES_DAILY_
}
target=/Volumes/MEDIA/Audio\ Files/$(date +%y%m%d)
audiolink=alias
if [ "$audiolink" != "$target" ]
then
mkdir /Volumes/MEDIA/Audio\ Files/$(date +%Y%m%d)
ln -sf /Volumes/MEDIA/Audio\ Files/$(date +%Y%m%d) ~/Desktop/_AUDIO_FILES_DAILY_
else
echo All Good
fi
Thanks