Shell script to replace some files with symlinks
Some servers support ftp for downloading files.
When I export a project from my subversion repository to my windows machine, all symlinks (linux) are replaced with placeholder files:
link ../www_public/images
after downloading all exported files i am now using
find | xargs grep -P ^ link
to find all those placeholders. Then I replace them with the actual symlink manually.
I would really like to automate this step with a shell-script.
How should I do it?
Note:
If there is a better / great solution to this problem, feel free to share it :)
+1
Jacco
source
to share
1 answer
Here's one possible solution:
:
grep -lr '^link' . | while read placeholderfile
do
linkfile=`cut -c6- "$placeholderfile"`
ln -sf "$linkfile" "$placeholderfile"
done
edit: changed the code above wrt comments below.
+2
Bill karwin
source
to share