From the /bar directory, to create all symlinks for everything but these extensions.
find ../foo/ -type f ! -name '*.txt' ! -name '*.baz' -exec ln -s '{}' \;
And then to copy all the extensions, same command for the most part.
find ../foo/ -type f \( -name "*.txt" -o -name "*.baz" \) -exec cp '{}' ./ \;
Edit: Copy entire directory structure, symlink some files, copy others. Wasn't sure if this was possible at first with a single command, but just learned some other handy tricks with find.
find foo/ -type d -printf "mkdir -vp 'bar/%p'\n" -o -type f ! -name "*.txt" ! -name "*.baz" -printf "ln -vs '../%p' 'bar/%p'\n" -o -type f \( -name "*.txt" -o -name "*.baz" \) -printf "cp -v %p bar/%p\n" | sh
mv bar/foo/* bar/ && rm -R bar/foo/
Only important thing to note is when making the symbolic link you give the actual path the links will take to relate to foo/. My example shows relative links when they are side by side (could also make absolute symbolic links as well).
I am assuming this is linux? – soandos – 2011-07-27T18:52:09.447
Yes, sorry, in linux. – Mike – 2011-07-27T20:23:17.280
Were /foo/a /foo/b foo/c meant to be directories? In that you need the entire directory structure copied under /foo, symlink all files not of a certain ext (in tree /foo), and finally copy all files of a certain ext (in tree /foo)? – Nicholi – 2011-07-27T21:44:27.617