convert symlinks to regular files

As you might need to convert a lot of symlinks to regular files (e.g. for windows compatibility reasons) you could use the following line to remove theme.
warning: This command deletes all symlinks infront to allow cp to copy them correctly to the target directory.


for f in `find . -type l`; do (cd `dirname $f`; target=`basename $f`; source=`readlink $target` ; rm -rf $target && cp -r $source $target || pwd); done

if you only linked files directly (without any directories) there are more elegant ways, but this works in every case.

usecase:

if you share a code repository with windows users they may do not understand symlinks.
you could convert all symlinks of the git using the following command:

find . type l | xargs git rm --cached
for f in `find . -type l`; do (cd `dirname $f`; target=`basename $f`; source=`readlink $target` ; rm -rf $target && cp -r $source $target || pwd); done
git status | grep "deleted" | awk '{print $2}' | xargs git add
git commit