2

I have:

$ find 1 2 -printf '%i %p\n'
40011805 1
40011450 1/t
40011923 1/a
40014006 1/a/e
40011217 1/a/q
40011806 2
40011458 2/y
40011924 2/a
40013989 2/a/e
40013945 2/a/w

I want:

<inode>  <path>
any      2
40011450 2/t
40011458 2/y
any      2/a
40014006 2/a/e
40011217 2/a/q
40013945 2/a/w

How do do it?

Vi.
  • 5,688

1 Answers1

2

Already answered.

Here is version adapted to this task:

D=$(readlink -f "2"); (cd "1" && find . -type f -print0 | cpio --pass-through --null --link --make-directories "$D") && rm -Rf 1

After this command I have exactly what I wanted:

$ find 1 2 -printf '%i %p\n'
find: `1': No such file or directory
40011806 2
40011450 2/t
40011458 2/y
40011924 2/a
40011217 2/a/q
40014006 2/a/e
40013945 2/a/w

Read notes about usage in the original answer (linked above).

Vi.
  • 5,688