2

I'm trying to symlink some php files using the following command:

find `pwd` -name "*.php" | ln -s * /home/frankv/www/bietroboter.de/symlinks

However, all the symlinks are broken because the little * does not reference the full path, only the file name itself. When I write them into a file using:

find `pwd` -name "*.php" > test.txt

It works. How can I pipe it correctly? Also, how can I tell it that I do not want any ".php" files that contain ".php~"

2 Answers2

6

A pipe takes the stdout from one process and connects it to the stdin of the next process; that doesn't make any sense for what you're trying to do (ln doesn't do anything with stdin).

You probably want something like this (untested):

find `pwd` -name "*.php" -execdir ln -s {} /home/frankv/www/bietroboter.de/symlinks \;
1

You can also use xargs to execute commands from standard input:

find pwd -name "*.php" | xargs ln -s -t /home/frankv/www/bietroboter.de/symlinks

Andrija
  • 11