WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Using find and cpio to copy parts of a directory  (Read 3543 times)

Offline vitex

  • Full Member
  • ***
  • Posts: 113
Using find and cpio to copy parts of a directory
« on: January 03, 2010, 10:47:56 AM »
As compensation for the confusion that I may have created with http://forum.tinycorelinux.net/index.php?topic=4476.0 , here is a cpio pass-mode example that may be useful.

See http://tinycorelinux.com/wiki/tiki-index.php?page=Creating+Extensions#When_DESTDIR_Fails.  The scripting in the post TC 2.4 case can be simplified to

Code: [Select]
touch /tmp/mark               # in case DESTDIR fails
make install DESTDIR=/tmp/pkg # DESTDIR may not work ...
( cd /                        # Copy any new files that make placed in /usr/local
  find usr/local -newer /tmp/mark -not -type d | cpio -pd /tmp/pkg
)
( cd /tmp ; mksquashfs pkg/ someapp.tcz )

Using find and cpio, it is easy to filter the list of files to be copied.  For example,
Code: [Select]
( cd /                       
  find usr/local -newer /tmp/mark -not -type d |
    grep -v /man/ |
    cpio -pd /tmp/pkg
)
would exclude all files in a /man/ directory.