Answer the question
In order to leave comments, you need to log in
Script to massively create symlinks by mask?
Essence of the question. There are folders conditionally "a" "b" "c" "d" in folder a there is a folder "x" you need to create a symlink to it in folders "b" "c" "d" (conditionally, actually there are 1kk folders) I do it
on bash (himself a humanist)
#!/bin/bash
ln -s /var/www/a/x /var/www/b
ln -s /var/www/a/x /var/www/c
ln -s /var/www/a/x /var/www/d
Answer the question
In order to leave comments, you need to log in
Change /file to your preferred name
Test (do not apply)
Run
find /var -maxdepth 1 -type d -exec ln -s /var/www/a/x {}/file \;
root_dir=/var/www
source_root=a
source_dir=x
for dir in $(find $root_dir -mindepth 1 -maxdepth 1 -type d | egrep -v "^root_dir/$source_root\$")
do
ln -s "$root_dir/$source_root/$source_dir" "$dir/$source_dir"
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question