Move a file and leave a soft link behind
A small note, is that you could use ln both times to make the command not actually move the data (assuming both paths are on the same filesystem).
ln /some/path/file /another/path/ && ln -sf /another/path/file /some/path/
But I assume that you want to move the content of /some/path/ to an other disk, and then create links to the new files so "no one" notices.
for f in `ls /some/path/`; do ln /some/path/$f /another/path/ && ln -sf /another/path/$f /some/path; done
Wrapping it in a bash function:
function cpln {
for f in `ls $1`
do
ln $1/$f $2 && ln -sf $2/$f $1
done
}
Theres my script you could use (takes two parameters /some/path/file and /another/path/ ):
#!/bin/bash
cp $1 $2
if [ "$?" -ne "0" ]; then
echo "Some error"
exit 1
fi
ln -sf $2/${1##*/} ${1%/*}