I need help in writing a script to create symbolic links. Here is a script that I have been running on background.
#!/bin/bash
SOURCE="/home/$USER/www"
DEST="/var/www"
while true; do
find $SOURCE -maxdepth 1 -type d -not -name "old.**" -exec ln -s -- {} "$DEST"/{} \;
find $DEST -maxdepth 1 -type l -exec test ! -e {} \; -delete
sleep 30
done
Now I would like this script to perform couple more tasks.
- Ignore already linked folders and
folders with 'old.' prefix. Remove symbolic-link from $DEST if the main folder is not available in $SOURCE.
Please help me to add those functionality on this script. Thanks.