On Wed, 12 Feb 2020 21:59:48 +0100 (CET), Yamaban wrote:
On Wed, 12 Feb 2020 21:38, Istvan Gabor <suseuser04@...> wrote:
Hello:
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?
Thanks,
Istvan
classic (bash-)shell script would be somesthing like this:
# for each file found do link via xargs find $source_dir -type f -print0 | xargs -0 -n 1 ln -s -t $targed_dir
yes, you can do it in find itself via: -exec ln ... but I'm not firm enough with the syntax to sprout it here.
Thanks, this does exactly what I want. How should I modify it, or how could I do it, if I wanted to apply it only to files with specific extensions, eg all .doc files? Thanks again, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org