On Wed, 19 Feb 2020 23:48:18 -0500, David T-G wrote:
Hi, all --
...and then Bernhard Voelker said... % ... % % # Create 'flattened' symlinks of all files in the relative $source_dir in ".". % $ find ../../../../src -type f -print0 | xargs -0 ln -nsvft . % './2' -> '../../../../src/b/2' % './4' -> '../../../../src/b/h/j/4' % './5' -> '../../../../src/b/h/i/5' % './1' -> '../../../../src/1' % './2' -> '../../../../src/2' % % BTW: As you can see, the file "2" exists several times below $source_dir, % and therefore the symlink gets overwritten. [snip]
I'm surprised nobody has brought up this problem before now; it's been chewing on me from day one. That's why I would name the links based on the path, like
path-to-src-b-2 path-to-src-b-h-j-4 path-to-src-b-h-i-5 path-to-src-1 path-to-src-2
in this example, to disambiguate.
I was aware of that identical file names might cause problems. Exactly for this reason in my original example I used different file names. I wrote this in my original post: 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 You see, there are not repeating file names. Of course, it is very useful to know how to deal with identical file names in different subdirectories. I just did not want to make my example complex complex. Cheers, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org