move/copy file by extension preserving directories hierarchy.

Andrey Tataranovich tataranovich at gmail.com
Thu Oct 23 07:02:34 UTC 2014


В Wed, 22 Oct 2014 17:07:19 -0700
"Mike Smithson" <mdooligan at gmail.com> пишет:

> tar cvf test.tar $(find /path/to/dir -name '*.png')
>
> then move the test.tar where you want, and un-tar it.

I suggest following example:

cd /path/to/src && find -name '*.png' -print0 | tar -cf- --null -T- | \
tar -xf- -C /path/to/dst

This example correctly preserve directory structure and process
files/dirs with spaces in names.

-- 
WBR, Andrey Tataranovich



More information about the mc mailing list