-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmakelinkdir
executable file
·36 lines (26 loc) · 941 Bytes
/
makelinkdir
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# Note: in order to be able to use the emulator, you need a writable copy of the files within the wins(cw) directory
if [ $# -lt 2 ]; then
echo "makelinkdir <source> <dest>"
exit 1
fi
SOURCE=$1
DEST=$2
if [ "`echo $DEST | grep ^/`" = "" ] || [ "`echo $SOURCE | grep ^/`" = "" ]; then
echo "The source and destination must be a absolute paths!"
exit 2
fi
cd $SOURCE
mkdir -p $DEST
find . -mindepth 1 -type d -exec mkdir $DEST/{} \;
find . -mindepth 1 -type f -exec ln -s $SOURCE/{} $DEST/{} \;
find . -mindepth 1 -type l -exec ln -s $SOURCE/{} $DEST/{} \;
#find . -mindepth 1 -type d -print0 | sed "s/\\([^\0]\\)\\.\\//\\1/g" | xargs -0r -i echo mkdir $DEST/{}
#find . -mindepth 1 -type f -print0 | sed "s/\\([^\0]\\)\\.\\//\\1/g" | xargs -0r -i echo ln -s $SOURCE/{} $DEST/{}
#for i in `find . -mindepth 1 | sed "s/^\\.\\///"`; do
# if [ -d $i ]; then
# mkdir $DEST/$i
# else
# ln -s $SOURCE/$i $DEST/$i
# fi
#done