Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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~"

share|improve this question
add comment

migrated from stackoverflow.com Dec 3 '11 at 7:45

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 3 down vote accepted

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 \;
share|improve this answer
    
Thanks Oli. What would I do if, let's say, they are all written down in a file and I read them out with cat test.txt? –  Frank Vilea Dec 2 '11 at 19:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.