Created
May 10, 2014 23:48
-
-
Save larrybolt/d5e1bcf0e159ee6a2461 to your computer and use it in GitHub Desktop.
symlink everything from /Volumes/Data/larrybolt/*/* to ~/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
# get all files and folders in the folder where this script is | |
for dir in $(ls $BASEDIR); do # loop trough each of them | |
if [ -d $dir ]; then # the file is a folder | |
if [ -d ~/$dir ]; then # it exists in our home folder as well | |
echo "$dir" | |
if [ -L ~/$dir ]; then | |
echo " - $dir is already symlinked!" | |
else | |
for arg2 in $(ls $dir); do | |
echo "$dir/$arg2" | |
if [ -L ~/$dir ]; then | |
echo " - $dir/$arg2 is already symlinked" | |
else | |
ln -s $BASEDIR/$dir/$arg2 ~/$dir/$arg2 | |
fi | |
done | |
fi | |
else | |
ln -s $BASEDIR/$dir ~/$dir | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment