Last active
July 26, 2016 11:02
-
-
Save mfehr/4851954de79994fbea4fca422d2241c7 to your computer and use it in GitHub Desktop.
Link all subfolders from one folder to another
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/bash | |
HELP="Usage: | |
./symlink_all_subfolders.sh [target folder] [source folder]" | |
if test "$#" -ne 2; then | |
echo "Illegal number of parameters!" | |
echo $HELP | |
exit 1 | |
fi | |
full_path_target=$(readlink -f $1) | |
full_path_source=$(readlink -f $2) | |
for i in $full_path_target/*; do | |
linkname=$full_path_source/$(basename $i) | |
echo "create link from $linkname to $i" | |
ln -s $i $linkname | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment