![](https://seccdn.libravatar.org/avatar/638c5f9b9a41e53d4663197a58261c49.jpg?s=120&d=mm&r=g)
Hello, On Wed, 12 Feb 2020, Istvan Gabor wrote:
I tried to summarize in the subject what I'd like to do:
I want to create symlinks for all the files within a folder recursively with the symlinks to be in one directory. For example:
Source dir:
source/dir1/a/file1 source/dir1/a/file2 source/dir1/a/file3 source/dir1/b/file4 source/dir1/b/file5 source/dir1/b/file6 source/file7
The target should be:
target/file1 -> source/dir1/a/file1 target/file2 -> source/dir1/a/file2 target/file3 -> source/dir1/a/file3 target/file4 -> source/dir1/b/file4 target/file5 -> source/dir1/b/file5 target/file6 -> source/dir1/b/file6 target/file7 -> source/file7
How could do it?
I created your directory structure. Then: $ mkdir target $ find source -type f -iname '*' -exec /bin/bash -c ' for arg; do ln -si "../$arg" "target/${arg##*\/}"; done; ' find-bash {} + $ ls -l target total 0 lrwxrwxrwx [..] file1 -> ../source/dir1/a/file1 lrwxrwxrwx [..] file2 -> ../source/dir1/a/file2 lrwxrwxrwx [..] file3 -> ../source/dir1/a/file3 lrwxrwxrwx [..] file4 -> ../source/dir1/b/file4 lrwxrwxrwx [..] file5 -> ../source/dir1/b/file5 lrwxrwxrwx [..] file6 -> ../source/dir1/b/file6 lrwxrwxrwx [..] file7 -> ../source/file7 The -iname '*' is there just as an example. HTH, -dnh -- New scheduler deployed on friday was buggy, we learn not to deploy larger changes on fridays anymore ;) -- Adrian Schröter in opensuse-buildservice -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org