1

This question already has an answer here:

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?

marked as duplicate by Graeme, Anthon, slm Jan 3 '15 at 22:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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).

Not the answer you're looking for? Browse other questions tagged or ask your own question.