May
7
A Shell script that generates symbol links for bunch of files
#!/bin/bash
#backup $IFS
#default $IFS is space
SAVEIFS=$IFS
#change $IFS for filename with space
IFS=$(echo -en “\n\b”)
for dir in `ls -F | grep “/$”`
do
if [ “$dir” != “all/” ]
then
echo “$dir”
for file in `ls $dir | grep .jpg$`
do
#echo $dir$file
ln -sf $PWD/$dir$file “/path/to/link/$file”
done
fi
done
#restore $IFS
IFS=$SAVEIFS