0

I have a directory with thousands of files, and I want to run a software multiple times in different directories with the same input files without copy the input in each directory, I have created a symbolic link to each file with the next code

ln -s /path/to/bayestraits/*_b.txt /path/to/bayestraits/dependiente_1

the directory structure is as follow

bayestraits
    dependiente_1
    dependiente_2
    dependiente_3

and I want to run the next code in each directory

for file in *_b.txt; do BayesTraitsV3 cyanomarkers_2.nex $file < Discrete_Dependent.txt ; done

the trouble is that when I run the code, the output file is redirected to bayestraits directory no to dependiente_1 directory

  • Is your current working directory one of the dependiente_? directories when you run your loop, or are you located in the bayestraits directory? Can you explicitly tell your program where to create its output files with an option? – Kusalananda Mar 26 at 9:43
0

Instead of symbolic links you could create hard links without the -s flag:

ln /path/to/bayestraits/*_b.txt /path/to/bayestraits/dependiente_1

To overwrite your existing symbolic links without removing them, use the -f (force) flag

ln -f /path/to/bayestraits/*_b.txt /path/to/bayestraits/dependiente_1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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